比赛 |
20140414 |
评测结果 |
WWWTTTTTTT |
题目名称 |
登机 |
最终得分 |
0 |
用户昵称 |
OI永别 |
运行时间 |
7.036 s |
代码语言 |
C++ |
内存使用 |
4.13 MiB |
提交时间 |
2014-04-14 11:27:33 |
显示代码纯文本
- #include<cstdio>
- #include<cstring>
- #include<algorithm>
- #include<iostream>
- #include<cstdlib>
- #include<cmath>
- using namespace std;
- #define N 200010
- struct arr{
- int s;
- long long t;
- }cow[N];
- int n;
- long long ans[N] = {0};
- inline int getint(){
- char ch;
- int x = 0;
- while (!isdigit(ch = getchar()));
- x = ch - 48;
- while (isdigit(ch = getchar())) x = x * 10 + ch - 48;
- return x;
- }
-
- int main(){
- freopen("boarding.in","r",stdin);
- freopen("boarding.out","w",stdout);
- n = getint();
- for (int i = 1; i <= n; i++){
- cow[i].s = getint();
- cow[i].t = getint();
- }
- for (int i = 1; i <= n; i++){
- ans[i] += cow[i].s + n - i;
- ans[i] += cow[i].t;
- }
- long long anss = 0;
- for (int i = 1; i <= n; i++){
- for (int j = n; j > i; j--){
- if (cow[i].s > cow[j].s) ans[i] += cow[j].t;
- }
- cout << ans[i] << endl;
- anss = max(ans[i],anss);
- }
- printf("%I64d\n",anss);
- return 0;
- }
-