QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#526897 | #7738. Equivalent Rewriting | Stelor | WA | 0ms | 3596kb | C++20 | 790b | 2024-08-22 00:36:55 | 2024-08-22 00:36:55 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
void solve()
{
int n,m;
std::cin>>n>>m;
vector<vector<int>> a(n+1);
vector<int> cnt(m+10),vis(m+10);
for(int i=1;i<=n;++i)
{
int p;
cin>>p;
while(p--)
{
int x;cin>>x;
cnt[x]++;
a[i].push_back(x);
}
}
if(n==1)
{
cout<<"No\n";return;
}
int l=0;
for(int i=n;i>=1;--i)
{
bool f=true;
for(auto j:a[i])
{
if(vis[j]||cnt[j]==1)
{
l=0;
}
else
{
f=false;
break;
}
}
if(f)
{
int q=i;
cout<<"Yes\n";
cout<<q<<" ";
for(int i=1;i<=n;++i) if(i!=q) cout<<i<<" ";
cout<<"\n"; return;
}
}
cout<<"No\n";
}
int main()
{
ios::sync_with_stdio(0),cin.tie(0);
int t;
cin>>t;
while(t--) solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3544kb
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 3 1 2 No No
result:
ok OK. (3 test cases)
Test #2:
score: -100
Wrong Answer
time: 0ms
memory: 3596kb
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)