# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1019220 | 2024-07-10T15:47:30 Z | ZeroCool | Unija (COCI17_unija) | C++14 | 252 ms | 49612 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define ar array #define int long long const int N = 5e5 + 20; const int INF = 1e17; const int MOD = 8; const int X = 4000; const int LOG = 21; #pragma GCC optimize("O3,Ofast,unroll-loops") #pragma GCC target("avx,avx2") bitset<N> del; bool cmp(ar<int, 2> a, ar<int, 2> b){ if(a[0] == b[0])return a[1] > b[1]; return a[0] < b[0]; } signed main(){ios_base::sync_with_stdio(false);cin.tie(0); int n; cin>>n; ar<int, 2> A[n]; for(int i = 0;i < n;i++){ cin>>A[i][0]>>A[i][1]; } sort(A, A + n, cmp); vector<ar<int, 2> > v; v.push_back(A[0]); for(int i = 1;i < n;i++){ while(v.back()[1] < A[i][1])v.pop_back(); v.push_back(A[i]); } int ans = v[0][0] * v[0][1]; for(int i = 1;i < v.size();i++)ans += v[i][0] * v[i][1] - v[i-1][0] * v[i][1]; cout<<ans; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 348 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 464 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 592 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 245 ms | 49388 KB | Output is correct |
2 | Correct | 212 ms | 48064 KB | Output is correct |
3 | Correct | 230 ms | 49612 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 460 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 1040 KB | Output is correct |
2 | Correct | 6 ms | 1116 KB | Output is correct |
3 | Correct | 6 ms | 1116 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 22 ms | 3164 KB | Output is correct |
2 | Correct | 20 ms | 3292 KB | Output is correct |
3 | Correct | 22 ms | 3420 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 63 ms | 8964 KB | Output is correct |
2 | Correct | 78 ms | 8976 KB | Output is correct |
3 | Correct | 63 ms | 8980 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 225 ms | 31056 KB | Output is correct |
2 | Correct | 252 ms | 30976 KB | Output is correct |
3 | Correct | 224 ms | 31052 KB | Output is correct |