QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#657177#7738. Equivalent RewritingAlucardWA 15ms105208kbC++141.6kb2024-10-19 14:18:482024-10-19 14:18:48

Judging History

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

  • [2024-10-19 14:18:48]
  • 评测
  • 测评结果:WA
  • 用时:15ms
  • 内存:105208kb
  • [2024-10-19 14:18:48]
  • 提交

answer

#include <bits/stdc++.h>
#include <iostream>

using namespace std;
 
typedef long long ll;

typedef long double ld;
typedef unsigned long long ull;
typedef pair<int,int> PII;
typedef pair<ll,ll> PLL;
#define i128 _int128

#define fi first
#define se second 
#define pb push_back

#define ICPC_CD return
#define Chong 0
#define endl '\n'

const ll INF=0x3f3f3f3f;
const ll N=2e6+9;
const ll mod=998244353;

int n,m;
map<int,int> v[N];
int check[N];
map<int,int> v1;

void solve(){
    cin>>n>>m;memset(check,0,sizeof(check));v1.clear();
    if(n==1)cout<<"No"<<endl;
    else{
        for(int i=1;i<=n;++i){
            int x;cin>>x;v[i].clear();
            for(int j=1;j<=x;++j){
                int xx;cin>>xx;
                v[i][xx]=i;
            }
        }
        for(int i=1;i<=n;++i){
            for(int j=1;j<=m;++j){
                if(v[i][j]){
                    if(v1[j]){
                        check[v1[j]]=1,check[i]=1;
                    }
                    v1[j]=v[i][j];
                }
            }
        }
        int f=0,id=0;
        for(int i=1;i<=n;++i){
            if(check[i]==0){f=1,id=i;break;}
        }
        if(f){
            cout<<"Yes"<<endl<<id;
            for(int i=1;i<=n;++i){
                if(i==id)continue;
                cout<<' '<<i;
            }
            cout<<endl;
        }
        else{
            cout<<"No"<<endl;
        }
    }
    
    
    
}



signed main(){
    ios::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    
    int _=1;
    cin>>_;
    
    while(_--)solve();

    ICPC_CD Chong;
}

詳細信息

Test #1:

score: 100
Accepted
time: 15ms
memory: 105156kb

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: 4ms
memory: 105208kb

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)