#include <bits/stdc++.h>
using namespace std;
int main()
{
int n,k,ans=0;
cin>>n>>k;
long long r[n][k],u[n][k];
for(int i=0;i<n;i++)
for(int j=0;j<k;j++)
cin>>r[i][j];
for(int i=0;i<n;i++)
for(int j=0;j<k;j++)
cin>>u[i][j];
long long p[k]={0};bool used[n]={0};
for(int i=0;i<n;i++)
for(int j=0;j<n;j++)
{
if(used[j])continue;
bool check=1;
for(int g=0;g<k;g++)
if(p[g]<r[j][g]){check=0;break;}
if(check)
{
used[j]=1;
ans++;
for(int g=0;g<k;g++)
p[g]+=u[j][g];
}
}
cout<<ans;
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
4 ms |
600 KB |
Output is correct |
4 |
Correct |
375 ms |
23708 KB |
Output is correct |
5 |
Correct |
384 ms |
23888 KB |
Output is correct |
6 |
Correct |
380 ms |
23888 KB |
Output is correct |
7 |
Correct |
250 ms |
23892 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
0 ms |
348 KB |
Output is correct |
4 |
Correct |
0 ms |
348 KB |
Output is correct |
5 |
Correct |
0 ms |
348 KB |
Output is correct |
6 |
Correct |
0 ms |
348 KB |
Output is correct |
7 |
Correct |
6 ms |
348 KB |
Output is correct |
8 |
Correct |
6 ms |
600 KB |
Output is correct |
9 |
Correct |
4 ms |
604 KB |
Output is correct |
10 |
Correct |
5 ms |
640 KB |
Output is correct |
11 |
Correct |
6 ms |
632 KB |
Output is correct |
12 |
Correct |
5 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
348 KB |
Output is correct |
2 |
Correct |
1 ms |
348 KB |
Output is correct |
3 |
Correct |
48 ms |
344 KB |
Output is correct |
4 |
Execution timed out |
1044 ms |
1880 KB |
Time limit exceeded |
5 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
348 KB |
Output is correct |
2 |
Correct |
0 ms |
348 KB |
Output is correct |
3 |
Correct |
4 ms |
600 KB |
Output is correct |
4 |
Correct |
375 ms |
23708 KB |
Output is correct |
5 |
Correct |
384 ms |
23888 KB |
Output is correct |
6 |
Correct |
380 ms |
23888 KB |
Output is correct |
7 |
Correct |
250 ms |
23892 KB |
Output is correct |
8 |
Correct |
1 ms |
348 KB |
Output is correct |
9 |
Correct |
0 ms |
348 KB |
Output is correct |
10 |
Correct |
0 ms |
348 KB |
Output is correct |
11 |
Correct |
0 ms |
348 KB |
Output is correct |
12 |
Correct |
0 ms |
348 KB |
Output is correct |
13 |
Correct |
0 ms |
348 KB |
Output is correct |
14 |
Correct |
6 ms |
348 KB |
Output is correct |
15 |
Correct |
6 ms |
600 KB |
Output is correct |
16 |
Correct |
4 ms |
604 KB |
Output is correct |
17 |
Correct |
5 ms |
640 KB |
Output is correct |
18 |
Correct |
6 ms |
632 KB |
Output is correct |
19 |
Correct |
5 ms |
604 KB |
Output is correct |
20 |
Correct |
1 ms |
348 KB |
Output is correct |
21 |
Correct |
1 ms |
348 KB |
Output is correct |
22 |
Correct |
48 ms |
344 KB |
Output is correct |
23 |
Execution timed out |
1044 ms |
1880 KB |
Time limit exceeded |
24 |
Halted |
0 ms |
0 KB |
- |