QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#665586#7738. Equivalent Rewriting369Pai#WA 1ms5884kbC++14793b2024-10-22 14:15:082024-10-22 14:15:09

Judging History

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

  • [2024-10-22 14:15:09]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:5884kb
  • [2024-10-22 14:15:08]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
#define rep(i,j,k) for(int i=j;i<=k;++i)
#define per(i,j,k) for(int i=j;i>=k;--i)
int const N=1e5+10;
bool vis[N];vector<int>a[N];
inline void solve(){
	int n,m;cin>>n>>m;
	rep(i,1,n) a[i].clear();
	rep(i,1,n){
		int x;cin>>x;
		while (x--){
			int y;cin>>y;
			a[i].push_back(y);
		}
	}
	rep(i,1,n-1){
		for (auto x:a[i]) vis[x]=1;
		bool win=1;
		for (auto x:a[i+1]) win&=!vis[x];
		for (auto x:a[i]) vis[x]=0;
		if (win){
			vector<int>a(n+1);
			rep(i,1,n) a[i]=i;
			swap(a[i],a[i+1]);
			cout<<"Yes\n";
			rep(i,1,n) cout<<a[i]<<' ';
			cout<<'\n';
			return;
		}
	}
	cout<<"No\n";
}
signed main(){
	ios::sync_with_stdio(false);
	cin.tie(0),cout.tie(0);
	int t;cin>>t;
	while (t--) solve();
	return 0;
}

詳細信息

Test #1:

score: 100
Accepted
time: 1ms
memory: 5868kb

input:

3
3 6
3 3 1 5
2 5 3
2 2 6
2 3
3 1 3 2
2 3 1
1 3
2 2 1

output:

Yes
1 3 2 
No
No

result:

ok OK. (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 1ms
memory: 5884kb

input:

1
10 5
2 2 4
4 1 3 4 2
1 2
3 2 1 4
4 5 2 4 3
3 2 5 4
3 5 4 2
3 1 3 2
5 1 4 2 3 5
1 4

output:

No

result:

wrong answer jury found an answer but participant did not (test case 1)