QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#85790 | #5689. 喵了个喵 II | whatever | Compile Error | / | / | C++17 | 2.9kb | 2023-03-08 15:33:48 | 2023-03-08 15:33:52 |
Judging History
你现在查看的是最新测评结果
- [2023-08-10 23:21:45]
- System Update: QOJ starts to keep a history of the judgings of all the submissions.
- [2023-03-08 15:33:52]
- 评测
- 测评结果:Compile Error
- 用时:0ms
- 内存:0kb
- [2023-03-08 15:33:48]
- 提交
answer
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;
using pii = pair<int, int>;
#define rep(i, a, b) for (int i = a, I = b; i <= I; ++i)
#define per(i, a, b) for (int i = a, I = b; i >= I; --i)
template<typename T> void down(T &x, T y) { if (x > y) x = y; }
const int M = 200000 * 44;
int cnt, dfn, id[M], low[M], bel[M], stk[M], top;
vector<int> e[M];
bool in_stk[M];
void tarjan(int u) {
id[u] = low[u] = ++dfn;
stk[++top] = u;
in_stk[u] = true;
for (auto v : e[u]) {
if (!id[v]) {
tarjan(v);
low[u] = min(low[u], low[v]);
} else if (in_stk[v]) {
low[u] = min(low[u], id[v]);
}
}
if (id[u] == low[u]) {
for (; ; --top) {
int x = stk[top];
bel[x] = u;
in_stk[x] = false;
if (x == u) break;
}
}
}
int ID(int x, int y) {
return x * 2 + y;
}
void add(int x, int y) {
e[x].push_back(y);
e[y ^ 1].push_back(x ^ 1);
}
const int S = 1 << 19 | 5;
int id_t[S];
void cover(int p, int l, int r, int ll, int rr, int x) {
if (l >= ll && r <= rr) {
if (id_t[p]) add(x, id_t[p]);
return;
}
int mid = (l + r) >> 1;
if (mid >= ll) cover(p << 1, l, mid, ll, rr, x);
if (mid < rr) cover(p << 1 | 1, mid + 1, r, ll, rr, x);
}
void add(int p, int l, int r, int pos, int x) {
int prv = id_t[p];
id_t[p] = ++cnt * 2;
if (prv) add(id_t[p], prv);
add(id_t[p], x);
if (l == r) return;
int mid = (l + r) >> 1;
if (mid >= pos) add(p << 1, l, mid, pos, x);
else add(p << 1 | 1, mid + 1, r, pos, x);
}
int n, a[200005], rk[200005];
bool ans[200005];
vector<int> pos[50005];
int main() {
ios::sync_with_stdio(0), cin.tie(0);
cin >> n;
rep(i, 1, 4 * n) {
cin >> a[i];
rk[i] = pos[a[i]].size();
pos[a[i]].push_back(i);
}
cnt = n;
per(i, 4 * n, 1) {
int x = a[i];
if (rk[i] == 2) {
cover(1, 1, 4 * n, i, pos[x][3], ID(x, 0));
add(1, 1, 4 * n, pos[x][3], ID(x, 1));
} else if (rk[i] == 1) {
cover(1, 1, 4 * n, i, pos[x][3], ID(x, 1));
add(1, 1, 4 * n, pos[x][3], ID(x, 0));
} else if (rk[i] == 0) {
cover(1, 1, 4 * n, i, pos[x][1], ID(x, 0));
cover(1, 1, 4 * n, i, pos[x][2], ID(x, 1));
add(1, 1, 4 * n, pos[x][1], ID(x, 1));
add(1, 1, 4 * n, pos[x][2], ID(x, 0));
}
}
rep(i, 2, cnt * 2 + 1) if (!id[i]) tarjan(i);
rep(i, 1, n) {
int x = ID(i, 0), y = ID(i, 1);
assert(bel[x] && bel[y]);
if (bel[x] == bel[y]) {
cout << "No\n";
return 0;
}
ans[pos[i][0]] = 1;
ans[pos[i][id[x] < id[y] ? 2 : 1]] = 1;
}
cout << "Yes\n";
rep(i, 1, 4 * n) cout << ans[i];
cout << "\n";
return 0;
}
詳細信息
answer.code:45:11: error: ‘int id_t [524293]’ redeclared as different kind of entity 45 | int id_t[S]; | ^ In file included from /usr/include/stdlib.h:394, from /usr/include/c++/11/bits/std_abs.h:38, from /usr/include/c++/11/cmath:47, from /usr/include/x86_64-linux-gnu/c++/11/bits/stdc++.h:41, from answer.code:1: /usr/include/x86_64-linux-gnu/sys/types.h:103:16: note: previous declaration ‘typedef __id_t id_t’ 103 | typedef __id_t id_t; | ^~~~ answer.code: In function ‘void cover(int, int, int, int, int, int)’: answer.code:48:17: error: expected unqualified-id before ‘[’ token 48 | if (id_t[p]) add(x, id_t[p]); | ^ answer.code:48:33: error: expected primary-expression before ‘[’ token 48 | if (id_t[p]) add(x, id_t[p]); | ^ answer.code: In function ‘void add(int, int, int, int, int)’: answer.code:56:19: error: expected primary-expression before ‘[’ token 56 | int prv = id_t[p]; | ^ answer.code:57:9: error: structured binding declaration cannot have type ‘id_t’ {aka ‘unsigned int’} 57 | id_t[p] = ++cnt * 2; | ^~~ answer.code:57:9: note: type must be cv-qualified ‘auto’ or reference to cv-qualified ‘auto’ answer.code:57:10: error: declaration of ‘auto p’ shadows a parameter 57 | id_t[p] = ++cnt * 2; | ^ answer.code:55:14: note: ‘int p’ previously declared here 55 | void add(int p, int l, int r, int pos, int x) { | ~~~~^ answer.code:57:9: error: cannot decompose non-array non-class type ‘int’ 57 | id_t[p] = ++cnt * 2; | ^~~ answer.code:58:22: error: expected primary-expression before ‘[’ token 58 | if (prv) add(id_t[p], prv); | ^ answer.code:59:13: error: expected primary-expression before ‘[’ token 59 | add(id_t[p], x); | ^