# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
257324 | 2020-08-04T06:01:44 Z | 문홍윤(#5062) | None (JOI16_worst_reporter2) | C++17 | 0 ms | 384 KB |
#include <bits/stdc++.h> #define eb emplace_back #define mp make_pair #define F first #define S second #define all(x) x.begin(), x.end() #define svec(x) sort(x.begin(), x.end()) #define press(x) x.erase(unique(x.begin(), x.end()), x.end()) #define lb(x, v) lower_bound(x.begin(), x.end(), v) #define ub(x, v) upper_bound(x.begin(), x.end(), v) using namespace std; typedef long long LL; typedef pair<int, int> pii; typedef pair<LL, LL> pll; typedef pair<int, LL> pil; typedef pair<LL, int> pli; const LL llinf=2000000000000000000; const LL mod1=1000000007; const LL mod2=998244353; const int inf=2000000000; int n, ans; pii a[200010], b[200010]; int cnt[200010]; int main(){ scanf("%d", &n); for(int i=1; i<=n; i++)scanf("%d %d", &a[i].S, &a[i].F); for(int i=1; i<=n; i++)scanf("%d %d", &b[i].S, &b[i].F); sort(a+1, a+n+1); sort(b+1, b+n+1); int pv=1, num=0; for(int i=1; i<=n; i++){ for(; pv<=n; pv++){ if(a[pv].F>b[i].F)break; num++; } if(num<i)return !printf("-1"); } pv=1, ans=n; for(int i=1; i<=n; i++){ for(; pv<=n; pv++){ if(a[pv].F>b[i].F)break; cnt[a[pv].S]++; } if(cnt[b[i].S]){ cnt[b[i].S]--; ans--; } } printf("%d", ans); } /* 6 1 70 4 50 1 30 2 20 1 10 3 0 6 100 2 90 1 80 2 60 4 40 1 10 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 0 ms | 384 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |