QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#281709#7738. Equivalent RewritingHarry27182WA 1ms6020kbC++14830b2023-12-10 16:19:102023-12-10 16:19:11

Judging History

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

  • [2023-12-10 16:19:11]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6020kb
  • [2023-12-10 16:19:10]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int T,n,m,k,num[100005];vector<int>v[100005];
int main()
{
    cin.tie(0)->sync_with_stdio(0);
    cin>>T;
    while(T--)
    {
    	cin>>n>>m;
    	for(int i=1;i<=n;i++)
    	{
    		cin>>k;v[i].clear();v[i].resize(k);
    		for(int j=0;j<v[i].size();j++)cin>>v[i][j];
		}
		int flag=0;
		for(int i=1;i<n;i++)
		{
			int ok=1;
			for(int j=0;j<v[i].size();j++)num[v[i][j]]=1;
			for(int j=0;j<v[i+1].size();j++)if(num[v[i+1][j]])ok=0;
			if(ok==1)
			{
				flag=1;cout<<"Yes\n";
				for(int j=1;j<i;j++)cout<<j<<' ';
				cout<<i+1<<' '<<i<<' ';
				for(int j=i+2;j<=n;j++)
				{
					cout<<j;
					if(j!=n)cout<<' ';
				}
				cout<<'\n';break; 
			}
			for(int j=0;j<v[i].size();j++)num[v[i][j]]=0;
		}
		if(!flag)cout<<"No\n";
	}
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

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: 0ms
memory: 6020kb

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)