# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
893331 | 2023-12-27T02:07:26 Z | Kubogi | Topical (NOI23_topical) | C++17 | 396 ms | 166056 KB |
#include <bits/stdc++.h> using namespace std; #define int long long #define fileio(name) if (fopen(name".inp", "r")) freopen(name".inp", "r", stdin), freopen(name".out", "w", stdout) const int maxn = 1e6+5; int n, m, cnt[maxn], p[maxn]; vector<int> a[maxn], u[maxn]; vector<pair<int, int>> val[maxn]; int32_t main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); fileio(""); // freopen("debug.txt", "w", stderr); cin >> n >> m; for (int i = 0; i <= n+1; i++) { a[i] = vector<int>(m+2, 0); u[i] = vector<int>(m+2, 0); } vector<int> cur; for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> a[i][j]; if (a[i][j] == 0) { cnt[i]++; } val[j].push_back({a[i][j], i}); } if (cnt[i] == m) { cur.push_back(i); } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= m; j++) { cin >> u[i][j]; } } for (int j = 1; j <= m; j++) { sort(val[j].rbegin(), val[j].rend()); while (!val[j].empty() && val[j].back().first == 0) { val[j].pop_back(); } } int res = 0; while (!cur.empty()) { int i = cur.back(); cur.pop_back(); res++; for (int j = 1; j <= m; j++) { p[j] += u[i][j]; while (!val[j].empty() && val[j].back().first <= p[j]) { int x = val[j].back().second; val[j].pop_back(); if (++cnt[x] == m) { cur.push_back(x); } } } } cout << res; return 0 ^ 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 72536 KB | Output is correct |
2 | Correct | 15 ms | 74328 KB | Output is correct |
3 | Correct | 18 ms | 75096 KB | Output is correct |
4 | Correct | 190 ms | 158956 KB | Output is correct |
5 | Correct | 190 ms | 158820 KB | Output is correct |
6 | Correct | 191 ms | 158900 KB | Output is correct |
7 | Correct | 173 ms | 150612 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 74328 KB | Output is correct |
2 | Correct | 16 ms | 74328 KB | Output is correct |
3 | Correct | 16 ms | 72280 KB | Output is correct |
4 | Correct | 15 ms | 72416 KB | Output is correct |
5 | Correct | 16 ms | 74328 KB | Output is correct |
6 | Correct | 15 ms | 72284 KB | Output is correct |
7 | Correct | 17 ms | 72796 KB | Output is correct |
8 | Correct | 18 ms | 72828 KB | Output is correct |
9 | Correct | 18 ms | 74720 KB | Output is correct |
10 | Correct | 17 ms | 73048 KB | Output is correct |
11 | Correct | 17 ms | 72676 KB | Output is correct |
12 | Correct | 18 ms | 72796 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 15 ms | 72536 KB | Output is correct |
2 | Correct | 15 ms | 72408 KB | Output is correct |
3 | Correct | 18 ms | 73428 KB | Output is correct |
4 | Correct | 46 ms | 81152 KB | Output is correct |
5 | Correct | 51 ms | 80972 KB | Output is correct |
6 | Correct | 396 ms | 166056 KB | Output is correct |
7 | Correct | 360 ms | 158632 KB | Output is correct |
8 | Correct | 389 ms | 166052 KB | Output is correct |
9 | Correct | 351 ms | 158552 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 16 ms | 72536 KB | Output is correct |
2 | Correct | 15 ms | 74328 KB | Output is correct |
3 | Correct | 18 ms | 75096 KB | Output is correct |
4 | Correct | 190 ms | 158956 KB | Output is correct |
5 | Correct | 190 ms | 158820 KB | Output is correct |
6 | Correct | 191 ms | 158900 KB | Output is correct |
7 | Correct | 173 ms | 150612 KB | Output is correct |
8 | Correct | 15 ms | 74328 KB | Output is correct |
9 | Correct | 16 ms | 74328 KB | Output is correct |
10 | Correct | 16 ms | 72280 KB | Output is correct |
11 | Correct | 15 ms | 72416 KB | Output is correct |
12 | Correct | 16 ms | 74328 KB | Output is correct |
13 | Correct | 15 ms | 72284 KB | Output is correct |
14 | Correct | 17 ms | 72796 KB | Output is correct |
15 | Correct | 18 ms | 72828 KB | Output is correct |
16 | Correct | 18 ms | 74720 KB | Output is correct |
17 | Correct | 17 ms | 73048 KB | Output is correct |
18 | Correct | 17 ms | 72676 KB | Output is correct |
19 | Correct | 18 ms | 72796 KB | Output is correct |
20 | Correct | 15 ms | 72536 KB | Output is correct |
21 | Correct | 15 ms | 72408 KB | Output is correct |
22 | Correct | 18 ms | 73428 KB | Output is correct |
23 | Correct | 46 ms | 81152 KB | Output is correct |
24 | Correct | 51 ms | 80972 KB | Output is correct |
25 | Correct | 396 ms | 166056 KB | Output is correct |
26 | Correct | 360 ms | 158632 KB | Output is correct |
27 | Correct | 389 ms | 166052 KB | Output is correct |
28 | Correct | 351 ms | 158552 KB | Output is correct |
29 | Correct | 225 ms | 108628 KB | Output is correct |
30 | Correct | 225 ms | 104312 KB | Output is correct |
31 | Correct | 279 ms | 111416 KB | Output is correct |
32 | Correct | 187 ms | 110752 KB | Output is correct |
33 | Correct | 188 ms | 104272 KB | Output is correct |
34 | Correct | 221 ms | 107564 KB | Output is correct |
35 | Correct | 259 ms | 111236 KB | Output is correct |
36 | Correct | 217 ms | 107520 KB | Output is correct |
37 | Correct | 240 ms | 107524 KB | Output is correct |
38 | Correct | 174 ms | 112844 KB | Output is correct |