# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1102824 | 2024-10-19T04:10:09 Z | blackslex | Topical (NOI23_topical) | C++17 | 1000 ms | 161396 KB |
#include<bits/stdc++.h> using namespace std; using pii = pair<int, int>; int n, k; int main() { scanf("%d %d", &n, &k); vector<vector<int>> r(n + 5, vector<int>(k + 5)), u(n + 5, vector<int>(k + 5)); vector<int> p(k + 5), done(n + 5); vector<multiset<pii>> ms(k + 5); for (int i = 1; i <= n; i++) { for (int j = 1; j <= k; j++) { scanf("%d", &r[i][j]); if (r[i][j]) ms[j].emplace(r[i][j], i); else done[i]++; } } for (int i = 1; i <= n; i++) { for (int j = 1; j <= k; j++) scanf("%d", &u[i][j]); } queue<int> q; vector<bool> f(n + 5); for (int i = 1; i <= n; i++) if (done[i] == k) q.emplace(i); while (!q.empty()) { int cur = q.front(); q.pop(); if (f[cur]) continue; f[cur] = 1; for (int j = 1; j <= k; j++) { p[j] += u[cur][j]; while (!ms[j].empty() && ms[j].begin()->first <= p[j]) { int i = ms[j].begin()->second; done[i]++; if (done[i] == k) q.emplace(i); ms[j].erase(ms[j].begin()); } } } int ans = 0; for (int i = 1; i <= n; i++) if (f[i]) ans++; printf("%d", ans); }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 3 ms | 1552 KB | Output is correct |
4 | Correct | 146 ms | 98060 KB | Output is correct |
5 | Correct | 147 ms | 98284 KB | Output is correct |
6 | Correct | 148 ms | 98060 KB | Output is correct |
7 | Correct | 208 ms | 145060 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 0 ms | 336 KB | Output is correct |
3 | Correct | 1 ms | 504 KB | Output is correct |
4 | Correct | 1 ms | 336 KB | Output is correct |
5 | Correct | 1 ms | 336 KB | Output is correct |
6 | Correct | 1 ms | 336 KB | Output is correct |
7 | Correct | 4 ms | 1104 KB | Output is correct |
8 | Correct | 4 ms | 848 KB | Output is correct |
9 | Correct | 3 ms | 848 KB | Output is correct |
10 | Correct | 4 ms | 848 KB | Output is correct |
11 | Correct | 4 ms | 1016 KB | Output is correct |
12 | Correct | 3 ms | 848 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 6 ms | 1872 KB | Output is correct |
4 | Correct | 64 ms | 17992 KB | Output is correct |
5 | Correct | 60 ms | 16268 KB | Output is correct |
6 | Execution timed out | 1069 ms | 161396 KB | Time limit exceeded |
7 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 336 KB | Output is correct |
2 | Correct | 1 ms | 336 KB | Output is correct |
3 | Correct | 3 ms | 1552 KB | Output is correct |
4 | Correct | 146 ms | 98060 KB | Output is correct |
5 | Correct | 147 ms | 98284 KB | Output is correct |
6 | Correct | 148 ms | 98060 KB | Output is correct |
7 | Correct | 208 ms | 145060 KB | Output is correct |
8 | Correct | 1 ms | 336 KB | Output is correct |
9 | Correct | 0 ms | 336 KB | Output is correct |
10 | Correct | 1 ms | 504 KB | Output is correct |
11 | Correct | 1 ms | 336 KB | Output is correct |
12 | Correct | 1 ms | 336 KB | Output is correct |
13 | Correct | 1 ms | 336 KB | Output is correct |
14 | Correct | 4 ms | 1104 KB | Output is correct |
15 | Correct | 4 ms | 848 KB | Output is correct |
16 | Correct | 3 ms | 848 KB | Output is correct |
17 | Correct | 4 ms | 848 KB | Output is correct |
18 | Correct | 4 ms | 1016 KB | Output is correct |
19 | Correct | 3 ms | 848 KB | Output is correct |
20 | Correct | 1 ms | 336 KB | Output is correct |
21 | Correct | 1 ms | 336 KB | Output is correct |
22 | Correct | 6 ms | 1872 KB | Output is correct |
23 | Correct | 64 ms | 17992 KB | Output is correct |
24 | Correct | 60 ms | 16268 KB | Output is correct |
25 | Execution timed out | 1069 ms | 161396 KB | Time limit exceeded |
26 | Halted | 0 ms | 0 KB | - |