Submission #1286224

#TimeUsernameProblemLanguageResultExecution timeMemory
1286224lucianTopical (NOI23_topical)C++20
40 / 100
1095 ms31744 KiB
#include <bits/stdc++.h> #define int long long using namespace std; int n, k; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k; int r[n + 1][k + 1]; int u[n + 1][k + 1]; int p[n + 1] = {0}; bool done[n + 1] = {false}; 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]; } } int completed = 0; bool progress = true; while(progress){ progress = false; for(int i = 0; i < n; i++){ if(done[i]){ continue; } bool can = true; for(int j = 0; j < k; j++){ if(p[j] < r[i][j]){ can = false; } } if(can){ done[i] = true; completed++; progress = true; for(int j = 0; j < k; j++){ p[j] += u[i][j]; } } } } cout << completed; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...