Submission #73789


ソースコード

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
28
#include <bits/stdc++.h>
using namespace std;
#define ll long long
#define all(x) x.begin(),x.end()
#define fol(i,s,g) for(int i=(int)(s); i<(int)(g); i++)
#define fix(ans,k) fixed << setprecision(k) << (double)ans
#define total(n) n*(n+1)/2
#define lcm(a,b) (a/__gcd(a,b)*b)
#define mod 998244353
int main(){
int n;
cin >> n;
vector<pair<ll,ll>> at(n);
fol(i,0,n){
cin >> at[i].first >> at[i].second;
}
sort(all(at));
ll time = max(at[n-1].first, at[n-1].second);
for(int i=n-2; i>=0; i--){
time = max(at[i].second, time + abs(at[i+1].first - at[i].first));
//cout << time << "\n";
}
time += at[0].first;
cout << time << "\n";
return 0;
}
//

ステータス

項目 データ
問題 1266 - いちご (Strawberry)
ユーザー名 ei2109
投稿日時 2022-10-14 17:54:46
言語 C++17
状態 Accepted
得点 100
ソースコード長 742 Byte
最大実行時間 85 ms
最大メモリ使用量 2288 KB

セット

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

テストケース

ファイル名 状態 実行時間 メモリ使用量 #
01-01.txt AC 27 ms 604 KB
1
01-02.txt AC 22 ms 448 KB
1
01-03.txt AC 20 ms 416 KB
1
01-04.txt AC 22 ms 508 KB
1
01-05.txt AC 18 ms 348 KB
1
01-06.txt AC 27 ms 444 KB
1
01-07.txt AC 18 ms 548 KB
1
01-08.txt AC 23 ms 520 KB
1
01-09.txt AC 28 ms 744 KB
1
01-10.txt AC 79 ms 2156 KB
1
01-11.txt AC 50 ms 1716 KB
1
01-12.txt AC 60 ms 1932 KB
1
01-13.txt AC 60 ms 1608 KB
1
01-14.txt AC 65 ms 1752 KB
1
01-15.txt AC 85 ms 2100 KB
1
01-16.txt AC 36 ms 1272 KB
1
01-17.txt AC 50 ms 1536 KB
1
01-18.txt AC 28 ms 840 KB
1
01-19.txt AC 62 ms 1872 KB
1
01-20.txt AC 76 ms 2016 KB
1
01-21.txt AC 35 ms 808 KB
1
01-22.txt AC 27 ms 828 KB
1
01-23.txt AC 72 ms 1940 KB
1
01-24.txt AC 73 ms 1992 KB
1
01-25.txt AC 71 ms 2064 KB
1
01-26.txt AC 64 ms 2012 KB
1
01-27.txt AC 67 ms 2084 KB
1
01-28.txt AC 80 ms 2156 KB
1
01-29.txt AC 76 ms 2228 KB
1
01-30.txt AC 74 ms 2176 KB
1
01-31.txt AC 64 ms 2244 KB
1
01-32.txt AC 65 ms 2184 KB
1
01-33.txt AC 79 ms 2256 KB
1
01-34.txt AC 85 ms 2196 KB
1
01-35.txt AC 84 ms 2140 KB
1
01-36.txt AC 69 ms 2212 KB
1
01-37.txt AC 68 ms 2288 KB
1
01-38.txt AC 75 ms 2104 KB
1
01-39.txt AC 80 ms 2176 KB
1
01-40.txt AC 79 ms 2120 KB
1
01-41.txt AC 84 ms 2064 KB
1
01-42.txt AC 68 ms 2140 KB
1
01-43.txt AC 75 ms 2212 KB
1
sample-01.txt AC 19 ms 748 KB
1
sample-02.txt AC 22 ms 588 KB
1
sample-03.txt AC 28 ms 692 KB
1