제출 #828854

#제출 시각아이디문제언어결과실행 시간메모리
828854t6twotwoTopical (NOI23_topical)C++17
100 / 100
443 ms83100 KiB
#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;
}

컴파일 시 표준 에러 (stderr) 메시지

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]) {
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...