Submission #1273123

#TimeUsernameProblemLanguageResultExecution timeMemory
1273123sopaipillaTopical (NOI23_topical)C++20
40 / 100
1095 ms47180 KiB
#include <bits/stdc++.h> #define int long long #define endl "\n" using namespace std; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(0); int n, k; cin >> n >> k; int r[n][k], u[n][k]; for(auto &aux : r) { for(int &aux2 : aux) cin >> aux2; } for(auto &aux : u) { for(int &aux2 : aux) cin >> aux2; } vector<int> st(k,0); priority_queue<vector<int>,vector<vector<int>>,greater<vector<int>>> pq; pq.push(st); vector<bool> vst(n,false); int ans=0; while(!pq.empty()) { auto at = pq.top(); pq.pop(); auto to=at; for(int i=0; i<n; ++i) { if(vst[i]) continue; bool ok=true; auto aux=at; for(int j=0; j<k; ++j) { if(at[j]<r[i][j]) { ok=false; break; } } if(ok) { vst[i]=true; ans++; for(int j=0; j<k; ++j) to[j]+=u[i][j]; } } if(to!=at) pq.push(to); } cout << ans << endl; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...