比赛 20140414 评测结果 WWWTTTTTTT
题目名称 登机 最终得分 0
用户昵称 OI永别 运行时间 7.036 s
代码语言 C++ 内存使用 4.13 MiB
提交时间 2014-04-14 11:27:33
显示代码纯文本
  1. #include<cstdio>
  2. #include<cstring>
  3. #include<algorithm>
  4. #include<iostream>
  5. #include<cstdlib>
  6. #include<cmath>
  7. using namespace std;
  8. #define N 200010
  9. struct arr{
  10. int s;
  11. long long t;
  12. }cow[N];
  13. int n;
  14. long long ans[N] = {0};
  15. inline int getint(){
  16. char ch;
  17. int x = 0;
  18. while (!isdigit(ch = getchar()));
  19. x = ch - 48;
  20. while (isdigit(ch = getchar())) x = x * 10 + ch - 48;
  21. return x;
  22. }
  23.  
  24. int main(){
  25. freopen("boarding.in","r",stdin);
  26. freopen("boarding.out","w",stdout);
  27. n = getint();
  28. for (int i = 1; i <= n; i++){
  29. cow[i].s = getint();
  30. cow[i].t = getint();
  31. }
  32. for (int i = 1; i <= n; i++){
  33. ans[i] += cow[i].s + n - i;
  34. ans[i] += cow[i].t;
  35. }
  36. long long anss = 0;
  37. for (int i = 1; i <= n; i++){
  38. for (int j = n; j > i; j--){
  39. if (cow[i].s > cow[j].s) ans[i] += cow[j].t;
  40. }
  41. cout << ans[i] << endl;
  42. anss = max(ans[i],anss);
  43. }
  44. printf("%I64d\n",anss);
  45. return 0;
  46. }
  47.