Submission #1107420

#TimeUsernameProblemLanguageResultExecution timeMemory
110742012345678Topical (NOI23_topical)C++17
40 / 100
1072 ms33108 KiB
#include <bits/stdc++.h> using namespace std; #define ll long long ll n, k, cnt; vector<ll> cur, p, vs; vector<vector<ll>> r, u; int main() { cin.tie(NULL)->sync_with_stdio(false); cin>>n>>k; cur.resize(k); p.resize(n); vs.resize(n); r.resize(n); u.resize(n); for (int i=0; i<n; i++) r[i].resize(k), u[i].resize(k); 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]; while (1) { ll progress=0; for (int i=0; i<n; i++) { while (p[i]<k&&cur[p[i]]>=r[i][p[i]]) p[i]++; if (!vs[i]&&p[i]==k) { vs[i]=1; cnt++; for (int j=0; j<k; j++) cur[j]+=u[i][j]; progress=1; } } if (!progress) break; } cout<<cnt; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...