# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
847859 |
2023-09-10T16:12:26 Z |
vjudge1 |
Unija (COCI17_unija) |
C++17 |
|
254 ms |
31308 KB |
#include <bits/stdc++.h>
using namespace std;
#define endl '\n'
#define pb push_back
#define ll long long
#define int ll
const long long inf=1e18;
const int MOD=1e9+7;
const int N=2e5+5;
signed main()
{
ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int n; cin>>n;
pair<int,int> p[n];
for(int i=0;i<n;i++){
cin>>p[i].second>>p[i].first;
p[i].first/=2;
}
sort(p,p+n,greater<pair<int,int>>());
int mx=p[0].second,sum=0;
for(int i=1;i<n;i++){
if(p[i].first!=p[i-1].first)sum+=(p[i-1].first-p[i].first)*mx;
mx=max(mx,p[i].second);
}
sum+=p[n-1].first*mx;
cout<<sum*2;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
760 KB |
Output is correct |
3 |
Correct |
1 ms |
496 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
344 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
344 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
2 ms |
600 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
254 ms |
31052 KB |
Output is correct |
2 |
Correct |
223 ms |
31056 KB |
Output is correct |
3 |
Correct |
225 ms |
31092 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Correct |
0 ms |
344 KB |
Output is correct |
3 |
Correct |
1 ms |
348 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
6 ms |
1112 KB |
Output is correct |
2 |
Correct |
6 ms |
1112 KB |
Output is correct |
3 |
Correct |
6 ms |
1116 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
20 ms |
3160 KB |
Output is correct |
2 |
Correct |
20 ms |
3160 KB |
Output is correct |
3 |
Correct |
23 ms |
3412 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
62 ms |
9040 KB |
Output is correct |
2 |
Correct |
61 ms |
9040 KB |
Output is correct |
3 |
Correct |
61 ms |
9040 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
225 ms |
31056 KB |
Output is correct |
2 |
Correct |
224 ms |
31096 KB |
Output is correct |
3 |
Correct |
226 ms |
31308 KB |
Output is correct |