QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#132618 | #6503. DFS Order 3 | Scapegoat_Dawn | WA | 1ms | 3796kb | C++14 | 906b | 2023-07-30 19:45:23 | 2023-07-30 19:45:26 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
inline int read() {
int x = 0;
char c = getchar();
bool f = 0;
while(!isdigit(c)) f |= (c == '-'), c = getchar();
while(isdigit(c)) x = (x * 10) + (c ^ 48), c = getchar();
return f ? -x : x;
}
const int maxn = 1005;
int T, n;
int D[maxn][maxn], Vst[maxn];
int main() {
// freopen("G.in", "r", stdin);
// freopen("G.out", "w", stdout);
T = read();
while(T--) {
n = read();
for(register int i = 1; i <= n; ++i) Vst[i] = 0;
for(register int i = 1; i <= n; ++i)
for(register int j = 1; j <= n; ++j) D[i][j] = read();
for(register int i = n; i > 1; --i) {
int x = D[1][i];
Vst[x] = 1;
for(register int j = 2; j <= n; ++j)
if(!Vst[D[x][j]]) printf("%d %d\n", x, D[x][j]);
}
}
return 0;
}
详细
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3796kb
input:
4 2 1 2 2 1 3 1 2 3 2 1 3 3 2 1 4 1 2 3 4 2 1 3 4 3 2 4 1 4 2 1 3 5 1 2 4 3 5 2 4 1 3 5 3 5 1 2 4 4 2 1 3 5 5 3 1 2 4
output:
2 1 3 2 3 1 2 1 4 2 4 1 4 3 3 2 3 1 2 1 5 3 5 1 5 2 5 4 3 1 3 2 3 4 4 2 4 1 2 1
result:
wrong answer ord[1] didn't pass the test (test case 2)