# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
965772 | 2024-04-19T07:11:19 Z | Trisanu_Das | Topical (NOI23_topical) | C++17 | 550 ms | 124404 KB |
#include<bits/stdc++.h> #define ll long long #define pb push_back #define mp make_pair #define ff first #define ss second using namespace std; const int N=1e6+6; vector< pair< ll, ll > > v[N]; vector< ll > u[N]; ll a[N], p[N]; ll b[N]; int main(){ ll t, n, k, i, j, ind, rn, x, ans; scanf("%lld",&n); scanf("%lld",&k); for(i=1; i<=n; i++){ for(j=1; j<=k; j++){ scanf("%lld",&x); v[j].pb(mp(x, i)); } } for(i=1; i<=n; i++){ for(j=1; j<=k; j++){ scanf("%lld",&x); u[i].pb(x); } } for(j=1; j<=k; j++) sort(v[j].begin(), v[j].end()); ans=0; ind=1; while(ans<n && ind==1){ ind=0; vector< ll > R; for(i=1; i<=k; i++){ while(v[i][p[i]].ff<=a[i] && p[i]<n){ b[v[i][p[i]].ss]++; if(b[v[i][p[i]].ss]==k) R.pb(v[i][p[i]].ss); p[i]++; } } rn=R.size(); if(rn){ ind++; ans+=rn; } for(i=0; i<rn; i++) for(j=0; j<k; j++) a[j+1]+=u[R[i]][j]; } printf("%lld\n", ans); return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 47964 KB | Output is correct |
2 | Correct | 11 ms | 48364 KB | Output is correct |
3 | Correct | 13 ms | 48848 KB | Output is correct |
4 | Correct | 249 ms | 113816 KB | Output is correct |
5 | Correct | 240 ms | 113812 KB | Output is correct |
6 | Correct | 248 ms | 114336 KB | Output is correct |
7 | Correct | 209 ms | 94508 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 47960 KB | Output is correct |
2 | Correct | 11 ms | 47960 KB | Output is correct |
3 | Correct | 13 ms | 47960 KB | Output is correct |
4 | Correct | 12 ms | 48220 KB | Output is correct |
5 | Correct | 11 ms | 48164 KB | Output is correct |
6 | Correct | 11 ms | 47964 KB | Output is correct |
7 | Correct | 13 ms | 48724 KB | Output is correct |
8 | Correct | 14 ms | 48632 KB | Output is correct |
9 | Correct | 13 ms | 48476 KB | Output is correct |
10 | Correct | 14 ms | 48412 KB | Output is correct |
11 | Correct | 13 ms | 48476 KB | Output is correct |
12 | Correct | 14 ms | 48472 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 12 ms | 47964 KB | Output is correct |
2 | Correct | 11 ms | 47964 KB | Output is correct |
3 | Correct | 15 ms | 48856 KB | Output is correct |
4 | Correct | 43 ms | 55088 KB | Output is correct |
5 | Correct | 46 ms | 56148 KB | Output is correct |
6 | Correct | 389 ms | 124404 KB | Output is correct |
7 | Correct | 536 ms | 116312 KB | Output is correct |
8 | Correct | 374 ms | 124404 KB | Output is correct |
9 | Correct | 550 ms | 116276 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 11 ms | 47964 KB | Output is correct |
2 | Correct | 11 ms | 48364 KB | Output is correct |
3 | Correct | 13 ms | 48848 KB | Output is correct |
4 | Correct | 249 ms | 113816 KB | Output is correct |
5 | Correct | 240 ms | 113812 KB | Output is correct |
6 | Correct | 248 ms | 114336 KB | Output is correct |
7 | Correct | 209 ms | 94508 KB | Output is correct |
8 | Correct | 11 ms | 47960 KB | Output is correct |
9 | Correct | 11 ms | 47960 KB | Output is correct |
10 | Correct | 13 ms | 47960 KB | Output is correct |
11 | Correct | 12 ms | 48220 KB | Output is correct |
12 | Correct | 11 ms | 48164 KB | Output is correct |
13 | Correct | 11 ms | 47964 KB | Output is correct |
14 | Correct | 13 ms | 48724 KB | Output is correct |
15 | Correct | 14 ms | 48632 KB | Output is correct |
16 | Correct | 13 ms | 48476 KB | Output is correct |
17 | Correct | 14 ms | 48412 KB | Output is correct |
18 | Correct | 13 ms | 48476 KB | Output is correct |
19 | Correct | 14 ms | 48472 KB | Output is correct |
20 | Correct | 12 ms | 47964 KB | Output is correct |
21 | Correct | 11 ms | 47964 KB | Output is correct |
22 | Correct | 15 ms | 48856 KB | Output is correct |
23 | Correct | 43 ms | 55088 KB | Output is correct |
24 | Correct | 46 ms | 56148 KB | Output is correct |
25 | Correct | 389 ms | 124404 KB | Output is correct |
26 | Correct | 536 ms | 116312 KB | Output is correct |
27 | Correct | 374 ms | 124404 KB | Output is correct |
28 | Correct | 550 ms | 116276 KB | Output is correct |
29 | Correct | 252 ms | 94620 KB | Output is correct |
30 | Correct | 238 ms | 89412 KB | Output is correct |
31 | Correct | 310 ms | 95136 KB | Output is correct |
32 | Correct | 214 ms | 85352 KB | Output is correct |
33 | Correct | 222 ms | 82556 KB | Output is correct |
34 | Correct | 249 ms | 86540 KB | Output is correct |
35 | Correct | 296 ms | 92096 KB | Output is correct |
36 | Correct | 240 ms | 89616 KB | Output is correct |
37 | Correct | 258 ms | 92380 KB | Output is correct |
38 | Correct | 226 ms | 84408 KB | Output is correct |