# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1107667 |
2024-11-01T21:50:39 Z |
imarn |
Topical (NOI23_topical) |
C++14 |
|
239 ms |
29108 KB |
#include<bits/stdc++.h>
#define ll long long
#define pii pair<int,int>
#define pll pair<ll,ll>
#define plx pair<ll,int>
#define f first
#define s second
#define pb push_back
#define all(x) x.begin(),x.end()
#define vi vector<int>
#define vvi vector<vi>
#define pp pair<ll,int>
#define ub(x,i) upper_bound(all(x),i)-x.begin()
using namespace std;
int main(){
ios_base::sync_with_stdio(0);cin.tie(0);
int n,k;cin>>n>>k;
pii a[k][n];
int u[n][k];
for(int i=0;i<n;i++)for(int j=0;j<k;j++)cin>>a[j][i].f,a[j][i].s=i;
for(int i=0;i<n;i++)for(int j=0;j<k;j++)cin>>u[i][j];
for(int i=0;i<k;i++)sort(a[i],a[i]+n);
int idx[k]={0},cnt[n]={0},v[k]={0};
int rs=0;
while(1){
queue<int>q;
for(int i=0;i<k;i++){
while(idx[i]<n&&v[i]>=a[i][idx[i]].f){
cnt[a[i][idx[i]].s]++;
if(cnt[a[i][idx[i]].s]==k)q.push(a[i][idx[i]].s);
idx[i]++;
}
}if(q.empty())break;
while(!q.empty()){
int x=q.front();q.pop();
for(int i=0;i<k;i++)v[i]+=u[x][i];
rs++;
}
}cout<<rs;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
2 ms |
592 KB |
Output is correct |
4 |
Correct |
128 ms |
29000 KB |
Output is correct |
5 |
Correct |
119 ms |
29108 KB |
Output is correct |
6 |
Correct |
114 ms |
19784 KB |
Output is correct |
7 |
Correct |
88 ms |
19872 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
1 ms |
336 KB |
Output is correct |
4 |
Correct |
1 ms |
336 KB |
Output is correct |
5 |
Correct |
1 ms |
336 KB |
Output is correct |
6 |
Correct |
1 ms |
336 KB |
Output is correct |
7 |
Correct |
2 ms |
592 KB |
Output is correct |
8 |
Correct |
3 ms |
592 KB |
Output is correct |
9 |
Correct |
2 ms |
592 KB |
Output is correct |
10 |
Correct |
2 ms |
724 KB |
Output is correct |
11 |
Correct |
3 ms |
592 KB |
Output is correct |
12 |
Correct |
2 ms |
336 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
3 ms |
592 KB |
Output is correct |
4 |
Correct |
23 ms |
3356 KB |
Output is correct |
5 |
Correct |
22 ms |
3140 KB |
Output is correct |
6 |
Correct |
222 ms |
28852 KB |
Output is correct |
7 |
Correct |
236 ms |
26440 KB |
Output is correct |
8 |
Correct |
227 ms |
28808 KB |
Output is correct |
9 |
Correct |
239 ms |
26592 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
336 KB |
Output is correct |
2 |
Correct |
1 ms |
336 KB |
Output is correct |
3 |
Correct |
2 ms |
592 KB |
Output is correct |
4 |
Correct |
128 ms |
29000 KB |
Output is correct |
5 |
Correct |
119 ms |
29108 KB |
Output is correct |
6 |
Correct |
114 ms |
19784 KB |
Output is correct |
7 |
Correct |
88 ms |
19872 KB |
Output is correct |
8 |
Correct |
1 ms |
336 KB |
Output is correct |
9 |
Correct |
1 ms |
336 KB |
Output is correct |
10 |
Correct |
1 ms |
336 KB |
Output is correct |
11 |
Correct |
1 ms |
336 KB |
Output is correct |
12 |
Correct |
1 ms |
336 KB |
Output is correct |
13 |
Correct |
1 ms |
336 KB |
Output is correct |
14 |
Correct |
2 ms |
592 KB |
Output is correct |
15 |
Correct |
3 ms |
592 KB |
Output is correct |
16 |
Correct |
2 ms |
592 KB |
Output is correct |
17 |
Correct |
2 ms |
724 KB |
Output is correct |
18 |
Correct |
3 ms |
592 KB |
Output is correct |
19 |
Correct |
2 ms |
336 KB |
Output is correct |
20 |
Correct |
1 ms |
336 KB |
Output is correct |
21 |
Correct |
1 ms |
336 KB |
Output is correct |
22 |
Correct |
3 ms |
592 KB |
Output is correct |
23 |
Correct |
23 ms |
3356 KB |
Output is correct |
24 |
Correct |
22 ms |
3140 KB |
Output is correct |
25 |
Correct |
222 ms |
28852 KB |
Output is correct |
26 |
Correct |
236 ms |
26440 KB |
Output is correct |
27 |
Correct |
227 ms |
28808 KB |
Output is correct |
28 |
Correct |
239 ms |
26592 KB |
Output is correct |
29 |
Correct |
188 ms |
25928 KB |
Output is correct |
30 |
Correct |
181 ms |
25312 KB |
Output is correct |
31 |
Correct |
208 ms |
23996 KB |
Output is correct |
32 |
Correct |
133 ms |
21072 KB |
Output is correct |
33 |
Correct |
154 ms |
22152 KB |
Output is correct |
34 |
Correct |
185 ms |
22004 KB |
Output is correct |
35 |
Correct |
197 ms |
23952 KB |
Output is correct |
36 |
Correct |
185 ms |
24964 KB |
Output is correct |
37 |
Correct |
213 ms |
27660 KB |
Output is correct |
38 |
Correct |
122 ms |
16456 KB |
Output is correct |