QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#246258 | #7738. Equivalent Rewriting | qwq7# | WA | 0ms | 3556kb | C++20 | 1.8kb | 2023-11-10 18:03:11 | 2023-11-10 18:03:12 |
Judging History
answer
// 哎 签到低手
#include<bits/stdc++.h>
using namespace std;
#define int long long
#define endl '\n'
#define PII pair<int,int>
#define PDI pair<double,int>
#define db double
#define all(x) (x).begin(),(x).end()
#define YES cout<<"Yes"<<endl;
#define NO cout<<"No"<<endl;
const int mod = 1e9+7;
void solve(){
int n,m;cin>>n>>m;
vector<int>v[n+1];
for(int i=1;i<=n;i++){
int x;cin>>x;
while(x--){
int now;cin>>now;
v[i].push_back(now);
}
}
for(int i=1;i<n;i++){
unordered_map<int,int>t;
int flag=0;
for(auto j:v[i])t[j]++;
for(auto j:v[i+1]){
t[j]++;
if(t[j]>=2){
flag=1;
}
}
if(!flag){
cout<<"Yes"<<endl;
vector<int>ans(n+1);
for(int j=1;j<=n;j++)ans[j]=j;
swap(ans[i],ans[i+1]);
for(int j=0;j<ans.size();j++){
if(j==0)cout<<ans[j];
else cout<<' '<<ans[j];
}cout<<endl;
return;
}
}
for(int i=1;i<n-1;i++){
unordered_map<int,int>t;
for(auto j:v[i])t[j]++;
for(auto j:v[i+1])t[j]++;
for(auto j:v[i+2]){
if(t.count(j))t.erase(j);
}
if(!t.size()){
cout<<"Yes"<<endl;
vector<int>ans(n+1);
for(int j=1;j<=n;j++)ans[j]=j;
swap(ans[i],ans[i+1]);
for(int j=0;j<ans.size();j++){
if(j==0)cout<<ans[j];
else cout<<' '<<ans[j];
}cout<<endl;
return;
}
}
cout<<"No"<<endl;
}
signed main(){
ios::sync_with_stdio(false);cin.tie(0);
int t=1;cin>>t;
while(t--)solve();
}
詳細信息
Test #1:
score: 0
Wrong Answer
time: 0ms
memory: 3556kb
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 0 1 3 2 No No
result:
wrong answer Integer parameter [name=q_i] equals to 0, violates the range [1, 3] (test case 1)