# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
257317 | 2020-08-04T05:53:12 Z | 송준혁(#5061) | Worst Reporter 2 (JOI16_worst_reporter2) | C++17 | 6 ms | 5120 KB |
#include <bits/stdc++.h> #define pb push_back #define lb lower_bound #define fi first #define se second #define mup(a,x) a=min(a,x) #define Mup(a,x) a=max(a,x) #define INF 1234567890 using namespace std; typedef long long LL; typedef pair<int,int> pii; int N, M, ans; pii A[404040]; vector<int> S[202020], V, T; int main(){ scanf("%d", &N); for (int i=1; i<=N; i++){ scanf("%d %d", &A[i].se, &A[i].fi); A[i].fi = A[i].fi*2; } for (int i=N+1; i<=2*N; i++){ scanf("%d %d", &A[i].se, &A[i].fi); A[i].fi = A[i].fi*2+1; } sort(A+1, A+2*N+1); for (int i=1; i<=2*N; i++){ if (A[i].fi & 1){ if (S[A[i].se].size()) S[A[i].se].pop_back(); else V.pb(A[i].fi); } else S[A[i].se].pb(A[i].fi); } for (int i=1; i<=N; i++) for (int t : S[i]) V.pb(t); sort(V.begin(), V.end()); for (int t : V){ if (t&1){ if (T.size()) T.pop_back(); ans++; } else T.pb(t); } ans += T.size(); printf("%d\n", ans); return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 5120 KB | Output is correct |
2 | Correct | 5 ms | 5120 KB | Output is correct |
3 | Correct | 6 ms | 5120 KB | Output is correct |
4 | Correct | 3 ms | 5120 KB | Output is correct |
5 | Correct | 5 ms | 5120 KB | Output is correct |
6 | Correct | 3 ms | 5120 KB | Output is correct |
7 | Correct | 3 ms | 5120 KB | Output is correct |
8 | Incorrect | 3 ms | 5120 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 5120 KB | Output is correct |
2 | Correct | 5 ms | 5120 KB | Output is correct |
3 | Correct | 6 ms | 5120 KB | Output is correct |
4 | Correct | 3 ms | 5120 KB | Output is correct |
5 | Correct | 5 ms | 5120 KB | Output is correct |
6 | Correct | 3 ms | 5120 KB | Output is correct |
7 | Correct | 3 ms | 5120 KB | Output is correct |
8 | Incorrect | 3 ms | 5120 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 5120 KB | Output is correct |
2 | Correct | 5 ms | 5120 KB | Output is correct |
3 | Correct | 6 ms | 5120 KB | Output is correct |
4 | Correct | 3 ms | 5120 KB | Output is correct |
5 | Correct | 5 ms | 5120 KB | Output is correct |
6 | Correct | 3 ms | 5120 KB | Output is correct |
7 | Correct | 3 ms | 5120 KB | Output is correct |
8 | Incorrect | 3 ms | 5120 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 5120 KB | Output is correct |
2 | Correct | 5 ms | 5120 KB | Output is correct |
3 | Correct | 6 ms | 5120 KB | Output is correct |
4 | Correct | 3 ms | 5120 KB | Output is correct |
5 | Correct | 5 ms | 5120 KB | Output is correct |
6 | Correct | 3 ms | 5120 KB | Output is correct |
7 | Correct | 3 ms | 5120 KB | Output is correct |
8 | Incorrect | 3 ms | 5120 KB | Output isn't correct |
9 | Halted | 0 ms | 0 KB | - |