제출 #1261931

#제출 시각아이디문제언어결과실행 시간메모리
1261931rayan_bdTopical (NOI23_topical)C++20
21 / 100
315 ms126500 KiB
#include <bits/stdc++.h> using namespace std; #define int long long #define all(x) x.begin(), x.end() signed main(){ ios_base::sync_with_stdio(0); cin.tie(nullptr); cout.tie(nullptr); int n, k, ans = 0; cin >> n >> k; vector<vector<int>> r(n + 1, vector<int> (k + 1, 0)); vector<vector<int>> v(n + 1, vector<int> (k + 1, 0)); vector<int> p(k + 1, 0); for(int i = 1; i <= n; ++i){ for(int j = 1; j <= k; ++j){ cin >> r[i][j]; } } for(int i = 1; i <= n; ++i){ for(int j = 1; j <= k; ++j){ cin >> v[i][j]; } } assert(k == 1); vector<pair<int, int>> vc; for(int i = 1; i <= n; ++i) vc.push_back({r[i][1], v[i][1]}); sort(all(vc)); for(int i = 0; i < n; ++i){ if(vc[i].first <= p[0]){ p[0] += vc[i].second; ans += 1; } } cout << ans << "\n"; return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...