제출 #1286226

#제출 시각아이디문제언어결과실행 시간메모리
1286226lucianTopical (NOI23_topical)C++17
12 / 100
102 ms16084 KiB
#include <bits/stdc++.h> using namespace std; int n, k; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k; int r[n + 1][k + 1]; int u[n + 1][k + 1]; int p[n + 1] = {0}; bool done[n + 1] = {false}; 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]; } } int completed = 0; bool progress = true; while(progress){ progress = false; for(int i = 0; i < n; i++){ if(done[i]){ continue; } bool can = true; for(int j = 0; j < k; j++){ if(p[j] < r[i][j]){ can = false; } } if(can){ done[i] = true; completed++; progress = true; for(int j = 0; j < k; j++){ p[j] += u[i][j]; } } } } cout << completed; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...