Submission #914128

# Submission time Handle Problem Language Result Execution time Memory
914128 2024-01-21T08:30:34 Z Litusiano Topical (NOI23_topical) C++17
40 / 100
1000 ms 24012 KB
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	int n,k; cin>>n>>k;
	vector<vector<int>> r(n,vector<int>(k,0)); auto u = r;
	for(auto& x : r){
		for(auto& i : x) cin>>i;
	}
	for(auto& x : u){
		for(auto& i : x) cin>>i;
	}
	unordered_set<int> idx; for(int i = 0; i<n; i++) idx.insert(i);
	int prev = 0;
	vector<int> act(k,0);
	while(prev != idx.size()){
		prev = idx.size();
		vector<int> temp;
		for(int i : idx){
			bool ok = 1;
			for(int j = 0; j<k; j++){
				// cerr<<"HERE "<<r[i][j]<<" "<<act[j]<<endl;
				ok&=(r[i][j] <= act[j]);
			}
			// cerr<<"END "<<endl;
			if(ok){
				temp.push_back(i);
				for(int z = 0; z<k; z++){
					act[z] += u[i][z];
				}
			}
		}
		for(int i : temp) idx.erase(i);
	}
	cout<<n-idx.size()<<endl;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:16:13: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::unordered_set<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   16 |  while(prev != idx.size()){
      |        ~~~~~^~~~~~~~~~~~~
# 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 4 ms 604 KB Output is correct
4 Correct 377 ms 24008 KB Output is correct
5 Correct 375 ms 23756 KB Output is correct
6 Correct 377 ms 24012 KB Output is correct
7 Correct 248 ms 23752 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 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 1 ms 348 KB Output is correct
7 Correct 6 ms 604 KB Output is correct
8 Correct 6 ms 604 KB Output is correct
9 Correct 4 ms 604 KB Output is correct
10 Correct 6 ms 604 KB Output is correct
11 Correct 6 ms 604 KB Output is correct
12 Correct 6 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 1 ms 348 KB Output is correct
3 Correct 7 ms 1884 KB Output is correct
4 Correct 71 ms 16072 KB Output is correct
5 Execution timed out 1059 ms 15972 KB Time limit exceeded
6 Halted 0 ms 0 KB -
# 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 4 ms 604 KB Output is correct
4 Correct 377 ms 24008 KB Output is correct
5 Correct 375 ms 23756 KB Output is correct
6 Correct 377 ms 24012 KB Output is correct
7 Correct 248 ms 23752 KB Output is correct
8 Correct 1 ms 344 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 1 ms 348 KB Output is correct
14 Correct 6 ms 604 KB Output is correct
15 Correct 6 ms 604 KB Output is correct
16 Correct 4 ms 604 KB Output is correct
17 Correct 6 ms 604 KB Output is correct
18 Correct 6 ms 604 KB Output is correct
19 Correct 6 ms 604 KB Output is correct
20 Correct 0 ms 348 KB Output is correct
21 Correct 1 ms 348 KB Output is correct
22 Correct 7 ms 1884 KB Output is correct
23 Correct 71 ms 16072 KB Output is correct
24 Execution timed out 1059 ms 15972 KB Time limit exceeded
25 Halted 0 ms 0 KB -