# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
862326 | 2023-10-18T04:12:17 Z | quandlm | Topical (NOI23_topical) | C++17 | 585 ms | 233888 KB |
#include <bits/stdc++.h> #define file(name) if (fopen (name".inp", "r")) { freopen (name".inp", "r", stdin); freopen (name".out", "w", stdout); } #define ll long long #define FOR(i, a, b) for (int i = (a); i <= (b); ++i) #define REP(i, a, b) for (int i = (a); i >= (b); --i) #define pi pair<int,int> #define ple tuple<int,int,int> #define fi first #define se second #define ii make_pair #define isz(a) ((int)a.size()) #define ALL(a) a.begin(), a.end() using namespace std; const int N = 1e6 + 10; int n,k; int p[N], cnt[N]; vector<vector<int>> a,b; priority_queue<pi,vector<pi>,greater<pi>> pq[N]; int main () { file("seq"); ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); cin >> n >> k; a.assign(n+10,vector<int>(k+10)); b.assign(n+10,vector<int>(k+10)); FOR(i,1,n) { FOR(j,1,k) { cin >> a[i][j]; pq[j].push({a[i][j], i}); } } FOR(i,1,n) { FOR(j,1,k) cin >> b[i][j]; } int res = 0; while(1) { vector<int> solved = {}; FOR(j,1,k) { while(!pq[j].empty() && p[j] >= pq[j].top().fi) { pi it = pq[j].top(); pq[j].pop(); cnt[it.se]++; if (cnt[it.se] == k) { solved.push_back(it.se); } } } for (int i : solved) { FOR(j,1,k) { p[j] += b[i][j]; } } res += isz(solved); if (isz(solved) == 0) break; } cout << res << '\n'; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 33368 KB | Output is correct |
2 | Correct | 6 ms | 33372 KB | Output is correct |
3 | Correct | 8 ms | 34652 KB | Output is correct |
4 | Correct | 198 ms | 166392 KB | Output is correct |
5 | Correct | 202 ms | 166384 KB | Output is correct |
6 | Correct | 197 ms | 166212 KB | Output is correct |
7 | Correct | 160 ms | 156684 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 33368 KB | Output is correct |
2 | Correct | 6 ms | 33372 KB | Output is correct |
3 | Correct | 6 ms | 33372 KB | Output is correct |
4 | Correct | 7 ms | 33372 KB | Output is correct |
5 | Correct | 6 ms | 33372 KB | Output is correct |
6 | Correct | 7 ms | 33460 KB | Output is correct |
7 | Correct | 8 ms | 33628 KB | Output is correct |
8 | Correct | 8 ms | 33628 KB | Output is correct |
9 | Correct | 8 ms | 33628 KB | Output is correct |
10 | Correct | 10 ms | 33868 KB | Output is correct |
11 | Correct | 8 ms | 33708 KB | Output is correct |
12 | Correct | 9 ms | 33880 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 33372 KB | Output is correct |
2 | Correct | 8 ms | 33372 KB | Output is correct |
3 | Correct | 11 ms | 35616 KB | Output is correct |
4 | Correct | 42 ms | 52936 KB | Output is correct |
5 | Correct | 41 ms | 52688 KB | Output is correct |
6 | Correct | 426 ms | 233768 KB | Output is correct |
7 | Correct | 585 ms | 229400 KB | Output is correct |
8 | Correct | 434 ms | 233888 KB | Output is correct |
9 | Correct | 573 ms | 229168 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 33368 KB | Output is correct |
2 | Correct | 6 ms | 33372 KB | Output is correct |
3 | Correct | 8 ms | 34652 KB | Output is correct |
4 | Correct | 198 ms | 166392 KB | Output is correct |
5 | Correct | 202 ms | 166384 KB | Output is correct |
6 | Correct | 197 ms | 166212 KB | Output is correct |
7 | Correct | 160 ms | 156684 KB | Output is correct |
8 | Correct | 6 ms | 33368 KB | Output is correct |
9 | Correct | 6 ms | 33372 KB | Output is correct |
10 | Correct | 6 ms | 33372 KB | Output is correct |
11 | Correct | 7 ms | 33372 KB | Output is correct |
12 | Correct | 6 ms | 33372 KB | Output is correct |
13 | Correct | 7 ms | 33460 KB | Output is correct |
14 | Correct | 8 ms | 33628 KB | Output is correct |
15 | Correct | 8 ms | 33628 KB | Output is correct |
16 | Correct | 8 ms | 33628 KB | Output is correct |
17 | Correct | 10 ms | 33868 KB | Output is correct |
18 | Correct | 8 ms | 33708 KB | Output is correct |
19 | Correct | 9 ms | 33880 KB | Output is correct |
20 | Correct | 7 ms | 33372 KB | Output is correct |
21 | Correct | 8 ms | 33372 KB | Output is correct |
22 | Correct | 11 ms | 35616 KB | Output is correct |
23 | Correct | 42 ms | 52936 KB | Output is correct |
24 | Correct | 41 ms | 52688 KB | Output is correct |
25 | Correct | 426 ms | 233768 KB | Output is correct |
26 | Correct | 585 ms | 229400 KB | Output is correct |
27 | Correct | 434 ms | 233888 KB | Output is correct |
28 | Correct | 573 ms | 229168 KB | Output is correct |
29 | Correct | 218 ms | 70224 KB | Output is correct |
30 | Correct | 240 ms | 66804 KB | Output is correct |
31 | Correct | 310 ms | 80164 KB | Output is correct |
32 | Correct | 156 ms | 61004 KB | Output is correct |
33 | Correct | 171 ms | 59520 KB | Output is correct |
34 | Correct | 214 ms | 63300 KB | Output is correct |
35 | Correct | 287 ms | 76728 KB | Output is correct |
36 | Correct | 235 ms | 66732 KB | Output is correct |
37 | Correct | 257 ms | 68904 KB | Output is correct |
38 | Correct | 198 ms | 69104 KB | Output is correct |