Submission #914131

# Submission time Handle Problem Language Result Execution time Memory
914131 2024-01-21T08:44:18 Z Litusiano Topical (NOI23_topical) C++17
40 / 100
1000 ms 24060 KB
#pragma GCC optimize("Ofast,unroll-loops,no-stack-protector,fast-math,inline")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,popcnt,lzcnt,mmx,abm,avx,avx2,fma")
#include<bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
	ios_base::sync_with_stdio(0);
	cin.tie(0);
	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:20: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]
   20 |  while(prev != idx.size()){
      |        ~~~~~^~~~~~~~~~~~~
# 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 2 ms 604 KB Output is correct
4 Correct 114 ms 23784 KB Output is correct
5 Correct 113 ms 24060 KB Output is correct
6 Correct 113 ms 23788 KB Output is correct
7 Correct 86 ms 23784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 344 KB Output is correct
2 Correct 0 ms 344 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 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 2 ms 604 KB Output is correct
8 Correct 2 ms 600 KB Output is correct
9 Correct 2 ms 600 KB Output is correct
10 Correct 2 ms 604 KB Output is correct
11 Correct 2 ms 600 KB Output is correct
12 Correct 2 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 5 ms 1884 KB Output is correct
4 Correct 43 ms 16076 KB Output is correct
5 Execution timed out 1057 ms 16048 KB Time limit exceeded
6 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 2 ms 604 KB Output is correct
4 Correct 114 ms 23784 KB Output is correct
5 Correct 113 ms 24060 KB Output is correct
6 Correct 113 ms 23788 KB Output is correct
7 Correct 86 ms 23784 KB Output is correct
8 Correct 1 ms 344 KB Output is correct
9 Correct 0 ms 344 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 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 2 ms 604 KB Output is correct
15 Correct 2 ms 600 KB Output is correct
16 Correct 2 ms 600 KB Output is correct
17 Correct 2 ms 604 KB Output is correct
18 Correct 2 ms 600 KB Output is correct
19 Correct 2 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 5 ms 1884 KB Output is correct
23 Correct 43 ms 16076 KB Output is correct
24 Execution timed out 1057 ms 16048 KB Time limit exceeded
25 Halted 0 ms 0 KB -