QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#246235#7738. Equivalent Rewritingqwq7#WA 0ms3748kbC++201.3kb2023-11-10 17:38:542023-11-10 17:38:55

Judging History

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

  • [2023-11-10 17:38:55]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3748kb
  • [2023-11-10 17:38:54]
  • 提交

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++){
        vector<int>t(m+1);
        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;
            for(int j=1;j<i;j++)ans.push_back(j);
            ans.push_back(i+1);
            ans.push_back(i);
            for(int j=i+2;j<=n;j++){
                ans.push_back(j);
            }
            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: 100
Accepted
time: 0ms
memory: 3748kb

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: 3592kb

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)