QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#81386 | #5521. Excellent XOR Problem | Smallbasic# | WA | 3ms | 5548kb | C++14 | 1.0kb | 2023-02-25 14:43:05 | 2023-02-25 14:43:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 5;
inline int read() {
register int s = 0, f = 1; register char ch = getchar();
while (!isdigit(ch)) f = (ch == '-' ? -1 : 1), ch = getchar();
while (isdigit(ch)) s = (s * 10) + (ch & 15), ch = getchar();
return s * f;
}
int n, a[N], top;
struct node {
int val, l, r;
inline node() { }
inline node(int V, int L, int R) : val(V), l(L), r(R) { }
inline void merge(const node &b) {
r = b.r;
val ^= b.val;
}
} stk[N];
map<int, int> vis;
int main() {
int T = read();
while (T--) {
n = read(); vis.clear();
for (int i = 1; i <= n; ++i) a[i] = read();
top = 0;
for (int i = 1; i <= n; ++i) {
stk[++top] = node(a[i], i, i);
++vis[a[i]];
while (vis[stk[top].val] >= 2) {
--vis[stk[top].val];
stk[top - 1].merge(stk[top]);
--top;
}
}
if (top == 1) puts("NO");
else {
puts("YES");
for (int i = 1; i <= top; ++i) printf("%d %d\n", stk[i].l, stk[i].r);
}
} return 0;
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 3ms
memory: 5548kb
input:
4 2 0 0 3 1 2 3 5 16 8 4 2 1 6 42 42 42 42 42 42
output:
NO YES 1 1 2 2 3 3 YES 1 1 2 2 3 3 4 4 5 5 NO
result:
wrong answer Integer 1 violates the range [2, 3] (test case 2)