QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#132617 | #6503. DFS Order 3 | Scapegoat_Dawn | WA | 1ms | 3624kb | C++14 | 987b | 2023-07-30 19:44:52 | 2023-07-30 19:45:23 |
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]);
Vst[D[x][j]] = 1;
}
}
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 0
Wrong Answer
time: 1ms
memory: 3624kb
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 4 2 4 1 4 3 5 3 5 1 5 2 5 4
result:
wrong answer ord[1] didn't pass the test (test case 2)