Submission #1102828

# Submission time Handle Problem Language Result Execution time Memory
1102828 2024-10-19T04:21:35 Z blackslex Topical (NOI23_topical) C++17
100 / 100
470 ms 160776 KB
#include<bits/stdc++.h>

using namespace std;
using pii = pair<int, int>;

int n, k;

int main() {
    cin.tie(nullptr)->sync_with_stdio(false);
    cin >> 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<priority_queue<pii, vector<pii>, greater<pii>>> pq(k + 5);
    vector<multiset<pii>> ms(k + 5);
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= k; j++) {
            cin >> r[i][j];
            if (r[i][j]) pq[j].emplace(r[i][j], i);
            else done[i]++;
        }
    }
    for (int i = 1; i <= n; i++) {
        for (int j = 1; j <= k; j++) cin >> u[i][j];
    }
    queue<int> q;
    for (int i = 1; i <= n; i++) if (done[i] == k) q.emplace(i);
    int ans = 0;
    while (!q.empty()) {
        int cur = q.front(); q.pop();
        ans++;
        for (int j = 1; j <= k; j++) {
            p[j] += u[cur][j];
            vector<pii> c;
            while (!pq[j].empty() && pq[j].top().first <= p[j]) {
                auto [x, y] = pq[j].top(); pq[j].pop();
                done[y]++;
                if (done[y] == k) q.emplace(y);
            }
        }
    }
    cout << ans;
}
# 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 2 ms 1616 KB Output is correct
4 Correct 135 ms 129540 KB Output is correct
5 Correct 137 ms 129548 KB Output is correct
6 Correct 139 ms 129540 KB Output is correct
7 Correct 174 ms 160776 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 1 ms 336 KB Output is correct
4 Correct 0 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 3 ms 592 KB Output is correct
8 Correct 3 ms 592 KB Output is correct
9 Correct 2 ms 592 KB Output is correct
10 Correct 3 ms 592 KB Output is correct
11 Correct 3 ms 592 KB Output is correct
12 Correct 3 ms 592 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 5 ms 1616 KB Output is correct
4 Correct 35 ms 12744 KB Output is correct
5 Correct 31 ms 12892 KB Output is correct
6 Correct 443 ms 124596 KB Output is correct
7 Correct 460 ms 124340 KB Output is correct
8 Correct 470 ms 124340 KB Output is correct
9 Correct 453 ms 124340 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 2 ms 1616 KB Output is correct
4 Correct 135 ms 129540 KB Output is correct
5 Correct 137 ms 129548 KB Output is correct
6 Correct 139 ms 129540 KB Output is correct
7 Correct 174 ms 160776 KB Output is correct
8 Correct 1 ms 336 KB Output is correct
9 Correct 1 ms 336 KB Output is correct
10 Correct 1 ms 336 KB Output is correct
11 Correct 0 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 3 ms 592 KB Output is correct
15 Correct 3 ms 592 KB Output is correct
16 Correct 2 ms 592 KB Output is correct
17 Correct 3 ms 592 KB Output is correct
18 Correct 3 ms 592 KB Output is correct
19 Correct 3 ms 592 KB Output is correct
20 Correct 1 ms 336 KB Output is correct
21 Correct 1 ms 336 KB Output is correct
22 Correct 5 ms 1616 KB Output is correct
23 Correct 35 ms 12744 KB Output is correct
24 Correct 31 ms 12892 KB Output is correct
25 Correct 443 ms 124596 KB Output is correct
26 Correct 460 ms 124340 KB Output is correct
27 Correct 470 ms 124340 KB Output is correct
28 Correct 453 ms 124340 KB Output is correct
29 Correct 188 ms 19528 KB Output is correct
30 Correct 198 ms 16612 KB Output is correct
31 Correct 304 ms 29416 KB Output is correct
32 Correct 153 ms 23732 KB Output is correct
33 Correct 167 ms 22960 KB Output is correct
34 Correct 223 ms 26184 KB Output is correct
35 Correct 286 ms 36372 KB Output is correct
36 Correct 236 ms 31816 KB Output is correct
37 Correct 274 ms 32280 KB Output is correct
38 Correct 128 ms 27792 KB Output is correct