제출 #1297495

#제출 시각아이디문제언어결과실행 시간메모리
1297495samarthkulkarniTopical (NOI23_topical)C++20
40 / 100
1096 ms23848 KiB
// noi 2023 final round #include <bits/stdc++.h> using namespace std; #define ll long long #define vi vector<long long> #define all(x) x.begin(), x.end() #define endl "\n" #define pr pair<ll, ll> #define ff first #define ss second void solution(); int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); solution(); return 0; } void solution() { ll n, k; cin >> n >> k; vector<vi> a(n, vi(k)), b(n, vi(k)); for (int i = 0; i < n; i++) { for (int j = 0; j < k; j++) cin >> a[i][j]; } for (int i = 0; i < n; i++) { for (int j = 0; j < k; j++) cin >> b[i][j]; } vi curr(k); set<ll> used; bool flag = true; while (used.size() < n && flag) { flag = false; for (int i = 0; i < n; i++) { if (used.contains(i)) continue; bool temp = true; for (int j = 0; j < k; j++) { if (curr[j] < a[i][j]) {temp = false; break;} } if (temp) { for (int j = 0; j < k; j++){ curr[j] += b[i][j]; } used.insert(i); flag = true; } } } cout << used.size() << 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...