QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#132618#6503. DFS Order 3Scapegoat_DawnWA 1ms3796kbC++14906b2023-07-30 19:45:232023-07-30 19:45:26

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-07-30 19:45:26]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3796kb
  • [2023-07-30 19:45:23]
  • 提交

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)