#include<bits/stdc++.h>
#ifdef LOCAL
#include "Essentials/algo/debug.h"
#else
#define debug(...) 69
#endif
using namespace std;
typedef long long ll;
typedef pair<int,int> pii;
const int N =1e7 + 23;
const ll inf = 1e18;
#define F first
#define S second
#define pb push_back
#define kill(x) cout<<x<<endl, exit(0);
#define all(x) x.begin(),x.end()
#define sz(x) (int)x.size()
#define lc (v << 1)
#define rc ((v<<1) |1)
//#define int ll
#define chmax(x,y) (x = max(x,y))
int n;
int a[N];
int32_t main() {
cin.tie(nullptr)->sync_with_stdio(false);
cin>>n;
for(int i = 0 ; i< n ;i ++) {
int x,y; cin>>x>>y;
chmax(a[x/2],y);
}
int mx=0;
ll ans=0;
for(int i = N-1; i>= 1; i --) {
chmax(mx,a[i]);
ans += mx;
}
cout<<ans*2 << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
604 KB |
Output is correct |
2 |
Correct |
11 ms |
348 KB |
Output is correct |
3 |
Correct |
11 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
348 KB |
Output is correct |
2 |
Correct |
11 ms |
464 KB |
Output is correct |
3 |
Correct |
11 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
344 KB |
Output is correct |
2 |
Correct |
11 ms |
344 KB |
Output is correct |
3 |
Correct |
11 ms |
348 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
556 KB |
Output is correct |
2 |
Correct |
11 ms |
496 KB |
Output is correct |
3 |
Correct |
12 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
188 ms |
6996 KB |
Output is correct |
2 |
Correct |
184 ms |
6992 KB |
Output is correct |
3 |
Correct |
209 ms |
6964 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
11 ms |
348 KB |
Output is correct |
2 |
Correct |
11 ms |
600 KB |
Output is correct |
3 |
Correct |
11 ms |
344 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
15 ms |
724 KB |
Output is correct |
2 |
Correct |
14 ms |
736 KB |
Output is correct |
3 |
Correct |
14 ms |
604 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
23 ms |
1372 KB |
Output is correct |
2 |
Correct |
27 ms |
1260 KB |
Output is correct |
3 |
Correct |
23 ms |
1116 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
52 ms |
2472 KB |
Output is correct |
2 |
Correct |
48 ms |
2408 KB |
Output is correct |
3 |
Correct |
48 ms |
2396 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
182 ms |
6968 KB |
Output is correct |
2 |
Correct |
151 ms |
7000 KB |
Output is correct |
3 |
Correct |
148 ms |
6960 KB |
Output is correct |