QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#561795#5423. Perfect Matchinglouhao088#Compile Error//Rust1.9kb2024-09-13 10:36:582024-09-13 10:36:58

Judging History

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

  • [2024-09-13 10:36:58]
  • 评测
  • [2024-09-13 10:36:58]
  • 提交

answer

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

int re, zf; char c;
int read() {
    re = 0; zf = 1;
    c = getchar();
    while (c < '0' || c > '9') {
        if (c == '-') zf = -zf;
        c = getchar();
    }
    while (c >= '0' && c <= '9') {
        re = re * 10 + c - '0';
        c = getchar();
    }
    return re * zf;
}

const int N = 3e5 + 100;
int n, a[N], b[N], c[N];
int bb[N], cc[N], db[N], dc[N];

struct node {
    int x, to, nxt;
}e[2][N];
int le[2][N], KK;
void add(int x, int y) {
    e[0][++KK] = (node){0, y, le[0][x]}; le[0][x] = KK;
    e[1][KK] = (node){0, x, le[1][y]}; le[1][y] = KK;
}
vector <int> ansb[N], ansc[N];

void slove() {
    scanf("%d", &n);
    for (int i = 1; i <= n; i++) {
        scanf("%d", &a[i]);
        b[i] = a[i] - i; c[i] = a[i] + i;
        bb[i] = b[i]; cc[i] = c[i];
    }
    sort(bb + 1, bb + n + 1); sort(cc + 1, cc + n + 1);
    int bn = unique(bb + 1, bb + n + 1) - bb - 1, cn = unique(cc + 1, cc + n + 1) - cc - 1;
    for (int i = 1; i <= n; i++) {
        b[i] = lower_bound(bb + 1, bb + bn + 1, b[i]) - bb;
        c[i] = lower_bound(cc + 1, cc + cn + 1, c[i]) - cc;
    }
    for (int i = 1; i <= bn; i++) db[i] = 0;
    for (int i = 1; i <= cn; i++) dc[i] = 0;
    for (int i = 1; i <= n; i++) db[b[i]]++, dc[c[i]]++, add(b[i], c[i]);

    queue <pair <int, bool> > q;
    for (int i = 1; i <= bn; i++)
        if (db[i] == 1) q.push(make_pair(i, 0));
    for (int i = 1; i <= cn; i++)
        if (dc[i] == 1) q.push(make_pair(i, 1));
    int num = 0;
    while (num <= n) {
        while (!q.empty()) {
            int now = q.front().first; bool op = q.front().second;
            q.pop();
            for (int i = le[op][now]; i; i = e[op][i].nxt)
                if (e[i].x)
        }
    }

    for (int i = 1; i <= n; i++) le[0][i] = le[1][i] = 0; KK = 0;
}

int main()
{
    int t = read();
    while (t--) slove();
    return 0;
}

Details

error: expected one of `!` or `[`, found `include`
 --> answer.code:1:2
  |
1 | #include<bits/stdc++.h>
  |  ^^^^^^^ expected one of `!` or `[`

error: aborting due to previous error