# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
246090 |
2020-07-08T07:17:35 Z |
VEGAnn |
Unija (COCI17_unija) |
C++14 |
|
451 ms |
13560 KB |
#include <bits/stdc++.h>
#define PB push_back
#define sz(x) ((int)x.size())
#define all(x) x.begin(),x.end()
using namespace std;
typedef long long ll;
typedef long double ld;
const int oo = 2e9;
const int N = 1000100;
const int md = 998244353;
const int PW = 233;
const int B = 700;
int n, a[N], b[N], nm[N];
ll ans = 0;
bool cmp(int _x, int _y){
if (a[_x] == a[_y])
return b[_x] < b[_y];
else return a[_x] > a[_y];
}
int main(){
ios_base::sync_with_stdio(0); cin.tie(0);
#ifdef _LOCAL
freopen("in.txt","r",stdin);
#endif // _LOCAl
cin >> n;
for (int i = 0; i < n; i++) {
cin >> a[i] >> b[i];
a[i] /= 2;
b[i] /= 2;
nm[i] = i;
}
sort(nm, nm + n, cmp);
int la = oo, lb = 0;
for (int it = 0; it < n; it++){
int i = nm[it];
if (lb >= b[i]) continue;
ans += (ll(b[i]) - ll(lb)) * ll(a[i]);
lb = b[i];
la = a[i];
}
cout << ans * 4;
return 0;
}
Compilation message
unija.cpp: In function 'int main()':
unija.cpp:41:9: warning: variable 'la' set but not used [-Wunused-but-set-variable]
int la = oo, lb = 0;
^~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
416 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
5 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
512 KB |
Output is correct |
2 |
Correct |
6 ms |
512 KB |
Output is correct |
3 |
Correct |
6 ms |
512 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
445 ms |
13308 KB |
Output is correct |
2 |
Correct |
434 ms |
13332 KB |
Output is correct |
3 |
Correct |
451 ms |
13432 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
5 ms |
384 KB |
Output is correct |
2 |
Correct |
5 ms |
384 KB |
Output is correct |
3 |
Correct |
4 ms |
384 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
14 ms |
1024 KB |
Output is correct |
2 |
Correct |
15 ms |
1024 KB |
Output is correct |
3 |
Correct |
15 ms |
1024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
39 ms |
2808 KB |
Output is correct |
2 |
Correct |
45 ms |
2808 KB |
Output is correct |
3 |
Correct |
44 ms |
2944 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
122 ms |
5624 KB |
Output is correct |
2 |
Correct |
115 ms |
5752 KB |
Output is correct |
3 |
Correct |
119 ms |
5752 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
446 ms |
13400 KB |
Output is correct |
2 |
Correct |
440 ms |
13560 KB |
Output is correct |
3 |
Correct |
451 ms |
13432 KB |
Output is correct |