QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#696213#6692. Building Company0x3fffffffCompile Error//Python32.0kb2024-10-31 21:50:502024-10-31 21:50:56

Judging History

你现在查看的是最新测评结果

  • [2024-10-31 21:50:56]
  • 评测
  • [2024-10-31 21:50:50]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define int long long

void solve() {
    int g;cin >> g;
    unordered_map<int, int>mp;
    vector<int>t(g + 1), u(g + 1);
    for (int i = 1;i <= g;i++) {
        cin >> t[i] >> u[i];
        mp[t[i]] = u[i];
    }
    int n;cin >> n;
    vector<vector<int>>a(n + 1), b(n + 1), c(n + 1), d(n + 1);
    vector<int>m(n + 1), k(n + 1);
    for (int i = 1;i <= n;i++) {
        cin >> m[i];
        a[i].resize(m[i] + 1);
        b[i].resize(m[i] + 1);
        for (int j = 1;j <= m[i];j++) {
            cin >> a[i][j] >> b[i][j];
        }
        cin >> k[i];
        c[i].resize(k[i] + 1);
        d[i].resize(k[i] + 1);
        for (int j = 1;j <= k[i];j++) {
            cin >> c[i][j] >> d[i][j];
        }
    }
    map<int, multiset<pair<int, int>>>s;
    vector<int>cnt(n + 1);
    for (int i = 1;i <= n;i++) {
        for (int j = 1;j <= m[i];j++) {
            if (mp[a[i][j]] < b[i][j]) {
                cnt[i]++;
                s[a[i][j]].emplace(b[i][j], i);
            }
        }
        if (!cnt[i]) {
            for (int j = 1;j <= k[i];j++) {
                mp[c[i][j]] += d[i][j];
                while (!s[c[i][j]].empty() and (*s[c[i][j]].begin()).first <= mp[c[i][j]]) {
                    auto it = s[c[i][j]].begin();
                    int id = (*it).second;
                    cnt[id]--;
                    if (!cnt[id]) {
                        for (int t = 1;t <= k[id];t++) {
                            mp[c[id][t]] += d[id][t];
                        }
                    }
                    s[c[i][j]].erase(it);
                }
            }
        }
    }
    int ans = 0;
    for (int i = 1;i <= n;i++) {
        if (!cnt[i])ans++;
    }
    cout << ans << "\n";


}

signed main() {
    ios::sync_with_stdio(0);
    cin.tie(0);
    int tt = 1;

#ifdef LOCAL
    freopen("data.in", "r", stdin);
    freopen("data.out", "w", stdout);
#endif
    // cin >> tt;
    while (tt--)
        solve();
    return 0;
}

详细

  File "answer.code", line 2
    using namespace std;
          ^^^^^^^^^
SyntaxError: invalid syntax