# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
100837 | 2019-03-14T19:56:00 Z | ikura355 | Exhibition (JOI19_ho_t2) | C++14 | 2 ms | 384 KB |
#include<bits/stdc++.h> using namespace std; #define pii pair<int,int> #define X first #define Y second const int maxn = 1e5 + 5; const int inf = 2e9; int n,m; pii a[maxn]; int b[maxn]; int wow[maxn], p[maxn]; int main() { //freopen("in.txt","r",stdin); //freopen("out.txt","w",stdout); scanf("%d%d",&n,&m); for(int i=1;i<=n;i++) scanf("%d%d",&a[i].X,&a[i].Y); for(int i=1;i<=m;i++) scanf("%d",&b[i]); sort(&a[1],&a[n+1]); sort(&b[1],&b[m+1],[&](int x, int y){return x>y;}); for(int i=n,j=0;i>=1;i--) { while(j+1<=m && b[j+1]>=a[i].X) j++; a[i].X = j; //printf("wow %d %d = %d\n",a[i].X,a[i].Y,wow[i]); } sort(&a[1],&a[n+1]); int mx = 0; p[0] = inf; for(int i=n;i>=1;i--) { int l = 0, r = mx, pos = 0; while(l<=r) { int mid = (l+r)/2; if(p[mid]>=a[i].Y) { pos = mid+1; l = mid+1; } else r = mid-1; } if(pos<=a[i].X) { p[pos] = a[i].Y; mx = max(mx, pos); } } printf("%d",mx); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 384 KB | Output is correct |
2 | Incorrect | 2 ms | 384 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |