QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#265469#6503. DFS Order 3qwq7WA 0ms3624kbC++20797b2023-11-25 18:38:542023-11-25 18:38:54

Judging History

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

  • [2023-11-25 18:38:54]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3624kb
  • [2023-11-25 18:38:54]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
//#define int long long
#define endl '\n'
using ll = long long ;
using pii = pair<int,int>;
template<class T>
T lowbit(T x){ return x&-x;}
#define ls u<<1
#define rs u<<1|1
const int mod = 998244353;
const int N = 2e5+10;
const int M = N<<1;
const int P = 1e9+7;
void solve(int id)
{
	int n;cin>>n;
	vector<int> vis(n+1,0);
	vector<pii> ans;
	for(int i=1;i<=n;i++)
	{
		vector<int> adj;
		for(int j=1;j<=n;j++)
		{
			int x;cin>>x;
			if(vis[x]) continue;
			adj.push_back(x);
		}
		ans.emplace_back(adj.front(),adj[1]);
		vis[adj.back()]=1;
	}
	for(auto [x,y]:ans) cout<<x<<' '<<y<<endl;
}
int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int t=1;
	cin>>t;
	for(int i=1;i<=t;i++) solve(i);
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
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:

1 2
1 0
1 2
2 1
2 22070
1 2
2 1
2 1
2 22070
1 2
2 4
1 2
2 1
2 22070

result:

wrong answer Integer parameter [name=y_i] equals to 0, violates the range [1, 3] (test case 2)