답안 #828854

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
828854 2023-08-17T17:44:21 Z t6twotwo Topical (NOI23_topical) C++17
100 / 100
443 ms 83100 KB
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    int n, m;
    cin >> n >> m;
    vector<int> f(n, m);
    queue<int> q;
    vector<vector<pair<int, int>>> s(m);
    for (int i = 0; i < n; i++) {
        vector<int> a(m);
        for (int &x : a) {
            cin >> x;
        }
        if (a == vector(m, 0)) {
            q.push(i);
        } else {
            for (int j = 0; j < m; j++) {
                s[j].emplace_back(a[j], i);
            }
        }
    }
    for (int i = 0; i < m; i++) {
        sort(s[i].begin(), s[i].end());
    }
    vector u(n, vector<int>(m));
    for (int i = 0; i < n; i++) {
        for (int &x : u[i]) {
            cin >> x;
        }
    }
    int ans = 0;
    vector<int> p(m);
    vector<ll> t(m);
    while (!q.empty()) {
        int i = q.front();
        q.pop();
        ans++;
        for (int j = 0; j < m; j++) {
            t[j] += u[i][j];
            while (p[j] < s[j].size() && s[j][p[j]].first <= t[j]) {
                auto [_, k] = s[j][p[j]++];
                if (!--f[k]) {
                    q.push(k);
                }
            }
        }
    }
    cout << ans << "\n";
    return 6/22;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:43:25: warning: comparison of integer expressions of different signedness: '__gnu_cxx::__alloc_traits<std::allocator<int>, int>::value_type' {aka 'int'} and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   43 |             while (p[j] < s[j].size() && s[j][p[j]].first <= t[j]) {
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 956 KB Output is correct
4 Correct 130 ms 39432 KB Output is correct
5 Correct 133 ms 39336 KB Output is correct
6 Correct 132 ms 39432 KB Output is correct
7 Correct 136 ms 70648 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 0 ms 212 KB Output is correct
7 Correct 2 ms 468 KB Output is correct
8 Correct 2 ms 468 KB Output is correct
9 Correct 2 ms 468 KB Output is correct
10 Correct 2 ms 468 KB Output is correct
11 Correct 2 ms 468 KB Output is correct
12 Correct 2 ms 468 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 3 ms 980 KB Output is correct
4 Correct 32 ms 6976 KB Output is correct
5 Correct 30 ms 6972 KB Output is correct
6 Correct 443 ms 68348 KB Output is correct
7 Correct 391 ms 80224 KB Output is correct
8 Correct 427 ms 83100 KB Output is correct
9 Correct 390 ms 80220 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 2 ms 956 KB Output is correct
4 Correct 130 ms 39432 KB Output is correct
5 Correct 133 ms 39336 KB Output is correct
6 Correct 132 ms 39432 KB Output is correct
7 Correct 136 ms 70648 KB Output is correct
8 Correct 0 ms 212 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 0 ms 212 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
13 Correct 0 ms 212 KB Output is correct
14 Correct 2 ms 468 KB Output is correct
15 Correct 2 ms 468 KB Output is correct
16 Correct 2 ms 468 KB Output is correct
17 Correct 2 ms 468 KB Output is correct
18 Correct 2 ms 468 KB Output is correct
19 Correct 2 ms 468 KB Output is correct
20 Correct 0 ms 212 KB Output is correct
21 Correct 0 ms 212 KB Output is correct
22 Correct 3 ms 980 KB Output is correct
23 Correct 32 ms 6976 KB Output is correct
24 Correct 30 ms 6972 KB Output is correct
25 Correct 443 ms 68348 KB Output is correct
26 Correct 391 ms 80224 KB Output is correct
27 Correct 427 ms 83100 KB Output is correct
28 Correct 390 ms 80220 KB Output is correct
29 Correct 205 ms 32804 KB Output is correct
30 Correct 216 ms 29524 KB Output is correct
31 Correct 243 ms 30672 KB Output is correct
32 Correct 155 ms 23548 KB Output is correct
33 Correct 170 ms 22304 KB Output is correct
34 Correct 199 ms 24900 KB Output is correct
35 Correct 261 ms 27120 KB Output is correct
36 Correct 196 ms 28008 KB Output is correct
37 Correct 231 ms 30736 KB Output is correct
38 Correct 150 ms 18780 KB Output is correct