답안 #1102827

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1102827 2024-10-19T04:20:46 Z blackslex Topical (NOI23_topical) C++17
21 / 100
544 ms 161704 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(n + 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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Runtime error 1 ms 472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 1 ms 380 KB Output is correct
5 Runtime error 1 ms 592 KB Execution killed with signal 11
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 4 ms 2112 KB Output is correct
4 Correct 36 ms 16072 KB Output is correct
5 Correct 31 ms 16072 KB Output is correct
6 Correct 481 ms 155572 KB Output is correct
7 Correct 544 ms 155420 KB Output is correct
8 Correct 522 ms 155572 KB Output is correct
9 Correct 537 ms 161704 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 336 KB Output is correct
2 Runtime error 1 ms 472 KB Execution killed with signal 11
3 Halted 0 ms 0 KB -