Submission #1285092

#TimeUsernameProblemLanguageResultExecution timeMemory
1285092nlsosadTopical (NOI23_topical)C++20
12 / 100
405 ms23828 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n, k; cin >> n >> k; vector<vector<int>> r(n+1, vector<int>(k+1)), u(n+1, vector<int>(k+1)); for (int i = 1;i<=n;++i){ for (int j = 1;j<=k;++j){ cin >> r[i][j]; } } for (int i = 1;i<=n;++i){ for (int j = 1;j<=k;++j){ cin >> u[i][j]; } } vector<bool> c(n+1, false); vector<int> p(k+1, 0); int dem = 0; while(true){ bool sol = false; for (int i = 1;i<=n;++i){ if(!c[i]){ bool check = true; for (int j = 1;j<=k;++j){ if(r[i][j] > p[j]){ check = false; break; } } if(check){ for (int j = 1;j<=k;++j){ p[j] += u[i][j]; } dem++; sol = true; c[i] = true; } } } if(!sol){ cout << dem; return 0; } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...