QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#665586 | #7738. Equivalent Rewriting | 369Pai# | WA | 1ms | 5884kb | C++14 | 793b | 2024-10-22 14:15:08 | 2024-10-22 14:15:09 |
Judging History
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)