QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#281709 | #7738. Equivalent Rewriting | Harry27182 | WA | 1ms | 6020kb | C++14 | 830b | 2023-12-10 16:19:10 | 2023-12-10 16:19:11 |
Judging History
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)