제출 #1184895

#제출 시각아이디문제언어결과실행 시간메모리
1184895NotLinuxTopical (NOI23_topical)C++20
12 / 100
146 ms70820 KiB
#include <bits/stdc++.h> using namespace std; #define sz(x) (int)x.size() #define all(x) x.begin() , x.end() const int inf = 1e9 + 7; void solve(){ int n,k; cin >> n >> k; int r[n][k] , u[n][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]; vector<pair<int,int>>v[k]; for(int j = 0;j<k;j++){ for(int i = 0;i<n;i++){ v[j].push_back({r[i][j] , i}); } sort(all(v[j])); } int ptr[k] = {0} , cnt[n] , cur[k] = {0} , ans = 0; fill(cnt , cnt + n , k); while(true){ bool work = 0; for(int i = 0;i<k;i++){ while(ptr[i] < sz(v[i]) and v[i][ptr[i]].first <= cur[i]){ work = 1; int satir = v[i][ptr[i]].second; cnt[satir]--; if(cnt[satir] == 0){// completed ans++; for(int j = 0;j<k;j++){ cur[j] += u[satir][j]; } } ptr[i]++; } } if(!work)break; } cout << ans << endl; } signed main(){ ios_base::sync_with_stdio(0);cin.tie(0); int testcase=1;//cin >> testcase; while(testcase--)solve(); cerr << 1000.0 * clock() / CLOCKS_PER_SEC << " ms" << 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...