QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#456795#8780. Training, Round 2ucup-team3678Compile Error//C++141.1kb2024-06-28 13:43:402024-06-28 13:43:44

Judging History

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

  • [2024-06-28 13:43:44]
  • 评测
  • [2024-06-28 13:43:40]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

const int N = 5005;

int S[N][N];
set<int> z[N];

signed main() {
    int n, p, q; scanf("%d%d%d", &n, &p, &q);
    S[0].insert(0), z[0].insert(0);
    for (int i = 1; i <= n; ++i) {
        int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
        a -= p, b -= p, c -= q, d -= q;
        for (int j = min(i - 1, b); j >= 0 && j >= a; --j) {
            set<int>::iterator it = z[j].lower_bound(c);
            vector<int> rm;
            vector< pair<int, int> > ad;
            while (it != z[j].end() && *it <= d) {
                rm.push_back(*it);
                if (!S[j][*it + 1]) ad.push_back({j, *it + 1});
                if (!S[j + 1][*it]) ad.push_back({j + 1, *it});
                ++it;
            }
            for (auto x : rm) z[j].erase(x);
            for (auto [x, y] : ad) S[x][y] = 1, z[x].insert(y);
        }
    }
    int res = 0;
    for (int i = 0; i <= n; ++i) {
        for (int j = 0; j <= n - i; ++j) {
            if (S[i][j]) res = max(res, i + j);
        }
    }
    printf("%d\n", res);
    return 0;
}

Details

answer.code: In function ‘int main()’:
answer.code:12:10: error: request for member ‘insert’ in ‘S[0]’, which is of non-class type ‘int [5005]’
   12 |     S[0].insert(0), z[0].insert(0);
      |          ^~~~~~
answer.code:27:23: warning: structured bindings only available with ‘-std=c++17’ or ‘-std=gnu++17’ [-Wc++17-extensions]
   27 |             for (auto [x, y] : ad) S[x][y] = 1, z[x].insert(y);
      |                       ^
answer.code:11:23: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   11 |     int n, p, q; scanf("%d%d%d", &n, &p, &q);
      |                  ~~~~~^~~~~~~~~~~~~~~~~~~~~~
answer.code:14:30: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   14 |         int a, b, c, d; scanf("%d%d%d%d", &a, &b, &c, &d);
      |                         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~