Submission #58480


ソースコード

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#include<bits/stdc++.h>
#define lol long long
#define mp make_pair
#define fi first
#define se second
using namespace std;
int a[100010],t[100010];
pair<int,int> pa[100010];
signed main(){
cin.tie(0);
ios::sync_with_stdio(false);
int n;
lol ti=0;
cin >>n;
for(int i=0;i<n;i++){
cin >>a[i]>>t[i];
pa[i]=mp(a[i],t[i]);
}
sort(pa,pa+n);
ti=max(pa[n-1].fi,pa[n-1].se);
for(int i=n-2;i>=0;i--){
ti+=pa[i+1].fi-pa[i].fi;
if(ti<pa[i].se) ti=pa[i].se;
}
cout <<ti+pa[0].fi<<'\n';
return (0);
}

ステータス

項目 データ
問題 1266 - いちご (Strawberry)
ユーザー名 ei1923
投稿日時 2020-02-05 16:45:28
言語 C++14
状態 Accepted
得点 100
ソースコード長 569 Byte
最大実行時間 54 ms
最大メモリ使用量 2368 KB

セット

セット 得点 Cases
1 ALL 100 / 100 *

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 28 ms 604 KB
1
01-02.txt AC 19 ms 680 KB
1
01-03.txt AC 20 ms 492 KB
1
01-04.txt AC 22 ms 564 KB
1
01-05.txt AC 24 ms 508 KB
1
01-06.txt AC 18 ms 448 KB
1
01-07.txt AC 23 ms 528 KB
1
01-08.txt AC 22 ms 600 KB
1
01-09.txt AC 27 ms 800 KB
1
01-10.txt AC 41 ms 2052 KB
1
01-11.txt AC 32 ms 1592 KB
1
01-12.txt AC 36 ms 1912 KB
1
01-13.txt AC 32 ms 1560 KB
1
01-14.txt AC 37 ms 1804 KB
1
01-15.txt AC 45 ms 2136 KB
1
01-16.txt AC 37 ms 1416 KB
1
01-17.txt AC 33 ms 1520 KB
1
01-18.txt AC 26 ms 936 KB
1
01-19.txt AC 38 ms 2072 KB
1
01-20.txt AC 33 ms 2196 KB
1
01-21.txt AC 28 ms 1100 KB
1
01-22.txt AC 23 ms 964 KB
1
01-23.txt AC 40 ms 1924 KB
1
01-24.txt AC 35 ms 2208 KB
1
01-25.txt AC 47 ms 2256 KB
1
01-26.txt AC 39 ms 2188 KB
1
01-27.txt AC 37 ms 2112 KB
1
01-28.txt AC 43 ms 2164 KB
1
01-29.txt AC 36 ms 2220 KB
1
01-30.txt AC 43 ms 2280 KB
1
01-31.txt AC 37 ms 2208 KB
1
01-32.txt AC 44 ms 2136 KB
1
01-33.txt AC 45 ms 2188 KB
1
01-34.txt AC 54 ms 2116 KB
1
01-35.txt AC 44 ms 2300 KB
1
01-36.txt AC 34 ms 2228 KB
1
01-37.txt AC 39 ms 2288 KB
1
01-38.txt AC 49 ms 2216 KB
1
01-39.txt AC 39 ms 2268 KB
1
01-40.txt AC 38 ms 2196 KB
1
01-41.txt AC 37 ms 2120 KB
1
01-42.txt AC 48 ms 2180 KB
1
01-43.txt AC 40 ms 2368 KB
1
sample-01.txt AC 28 ms 632 KB
1
sample-02.txt AC 26 ms 708 KB
1
sample-03.txt AC 23 ms 656 KB
1