# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1027636 | 2024-07-19T08:09:08 Z | FIFI_cpp | Unija (COCI17_unija) | C++17 | 241 ms | 49344 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
# | 결과 | 실행 시간 | 메모리 | 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 |
# | 결과 | 실행 시간 | 메모리 | 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 |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 0 ms | 348 KB | Output is correct |
2 | Correct | 1 ms | 460 KB | Output is correct |
3 | Correct | 1 ms | 476 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 604 KB | Output is correct |
2 | Correct | 1 ms | 604 KB | Output is correct |
3 | Correct | 1 ms | 604 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 202 ms | 32856 KB | Output is correct |
2 | Correct | 241 ms | 49344 KB | Output is correct |
3 | Correct | 220 ms | 48580 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 344 KB | Output is correct |
2 | Correct | 0 ms | 348 KB | Output is correct |
3 | Correct | 0 ms | 348 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 860 KB | Output is correct |
2 | Correct | 6 ms | 856 KB | Output is correct |
3 | Correct | 6 ms | 860 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 20 ms | 2024 KB | Output is correct |
2 | Correct | 21 ms | 3164 KB | Output is correct |
3 | Correct | 20 ms | 3432 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 60 ms | 4956 KB | Output is correct |
2 | Correct | 71 ms | 8968 KB | Output is correct |
3 | Correct | 79 ms | 8980 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 215 ms | 15964 KB | Output is correct |
2 | Correct | 206 ms | 31060 KB | Output is correct |
3 | Correct | 216 ms | 30952 KB | Output is correct |