# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
225986 | 2020-04-22T08:46:00 Z | Ruxandra985 | Exhibition (JOI19_ho_t2) | C++14 | 6 ms | 768 KB |
#include <bits/stdc++.h> #define DIMN 100010 using namespace std; int w[DIMN] , f[DIMN]; pair <int,pair <int,int> > v[DIMN]; pair <int , int> p[DIMN]; int n , m; int check (int nr){ int i , p2; memset (f , 0 , sizeof(f)); for (i = 1 ; i <= nr ; i++) f[p[i].second] = 1; p2 = m; for (i = n ; i ; i--){ if (f[v[i].second.second]){ if (w[p2] < v[i].second.first) return 0; p2--; } } return 1; } int main() { FILE *fin = stdin; FILE *fout = stdout; int i , st , dr , mid , ed = 0; fscanf (fin,"%d%d",&n,&m); for (i = 1 ; i <= n ; i++){ fscanf (fin,"%d%d",&v[i].second.first,&v[i].first); v[i].second.second = i; p[i] = make_pair(v[i].second.first , i); } for (i = 1 ; i <= m ; i++) fscanf (fin,"%d",&w[i]); sort (v + 1 , v + n + 1); sort (w + 1 , w + m + 1); sort (p + 1 , p + n + 1); st = 1; dr = min (n , m); while (st <= dr){ mid = (st + dr) / 2; if (check(mid)) st = mid + 1; else dr = mid - 1; } fprintf (fout,"%d",dr); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 768 KB | Output is correct |
2 | Correct | 5 ms | 768 KB | Output is correct |
3 | Correct | 5 ms | 768 KB | Output is correct |
4 | Correct | 5 ms | 768 KB | Output is correct |
5 | Correct | 5 ms | 768 KB | Output is correct |
6 | Correct | 6 ms | 768 KB | Output is correct |
7 | Correct | 5 ms | 768 KB | Output is correct |
8 | Correct | 5 ms | 768 KB | Output is correct |
9 | Correct | 6 ms | 768 KB | Output is correct |
10 | Correct | 5 ms | 768 KB | Output is correct |
11 | Correct | 5 ms | 768 KB | Output is correct |
12 | Correct | 5 ms | 768 KB | Output is correct |
13 | Incorrect | 5 ms | 672 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 768 KB | Output is correct |
2 | Correct | 5 ms | 768 KB | Output is correct |
3 | Correct | 5 ms | 768 KB | Output is correct |
4 | Correct | 5 ms | 768 KB | Output is correct |
5 | Correct | 5 ms | 768 KB | Output is correct |
6 | Correct | 6 ms | 768 KB | Output is correct |
7 | Correct | 5 ms | 768 KB | Output is correct |
8 | Correct | 5 ms | 768 KB | Output is correct |
9 | Correct | 6 ms | 768 KB | Output is correct |
10 | Correct | 5 ms | 768 KB | Output is correct |
11 | Correct | 5 ms | 768 KB | Output is correct |
12 | Correct | 5 ms | 768 KB | Output is correct |
13 | Incorrect | 5 ms | 672 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 768 KB | Output is correct |
2 | Correct | 5 ms | 768 KB | Output is correct |
3 | Correct | 5 ms | 768 KB | Output is correct |
4 | Correct | 5 ms | 768 KB | Output is correct |
5 | Correct | 5 ms | 768 KB | Output is correct |
6 | Correct | 6 ms | 768 KB | Output is correct |
7 | Correct | 5 ms | 768 KB | Output is correct |
8 | Correct | 5 ms | 768 KB | Output is correct |
9 | Correct | 6 ms | 768 KB | Output is correct |
10 | Correct | 5 ms | 768 KB | Output is correct |
11 | Correct | 5 ms | 768 KB | Output is correct |
12 | Correct | 5 ms | 768 KB | Output is correct |
13 | Incorrect | 5 ms | 672 KB | Output isn't correct |
14 | Halted | 0 ms | 0 KB | - |