Submission #929230

#TimeUsernameProblemLanguageResultExecution timeMemory
929230dubabubaTopical (NOI23_topical)C++14
0 / 100
10 ms1592 KiB
#include <bits/stdc++.h> using namespace std; vector<vector<int>> a, b; vector<int> cur, id; int main() { int n, k, t; cin >> n >> k; cur.resize(n + 1, 0); for(int i = 1; i <= n; i++) id.push_back(i); a.resize(n + 1, vector<int> (1, INT_MAX)); for(int i = 1; i <= n; i++) for(int j = 1; j <= k; j++) { cin >> t; a[i].push_back(t); a[i][0] = min(a[i][0], t); } b.resize(n + 1, vector<int> (1, INT_MAX)); for(int i = 1; i <= n; i++) for(int j = 1; j <= k; j++) { cin >> t; b[i].push_back(t); b[i][0] = min(b[i][0], t); } sort(id.begin(), id.end(), [&](int i, int j) { return a[i][0] < a[j][0]; }); int ans = 0; for(int i : id) { bool can = true; for(int j = 1; j <= k; j++) if(cur[j] < a[i][j]) can = false; if(can) { for(int j = 1; j <= k; j++) cur[j] += b[i][j]; ans++; } } cout << ans << endl; 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...