QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#730902#7738. Equivalent RewritingJun666WA 0ms3560kbC++201.3kb2024-11-09 22:19:042024-11-09 22:19:14

Judging History

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

  • [2024-11-09 22:19:14]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3560kb
  • [2024-11-09 22:19:04]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using i128=__int128_t;
#define int long long
void solve(){
       int n,m;
       cin>>m>>n;
       vector<vector<int>>p(m+1);
       vector<vector<int>>pp(m+1);
       vector<int>last(n+1,0);
       for(int i=1;i<=m;i++){
           int x;
           cin>>x;
           for(int j=0;j<x;j++){
                  
                int index;
                cin>>index;
                
                p[i].push_back(index);
                pp[i].push_back(last[index]);
                last[index]=i; 

           }
       }
       for(int i=m;i>=1;i--){
        int mx=0;
           for(size_t j=0;j<pp[i].size();j++){
                mx=max(mx,pp[i][j]);
           }
           if(mx<i-1){
                cout<<"Yes"<<'\n';
               for(int j=1;j<=m;j++){
                    if(j==i-1) cout<<i<<" \n"[j==m];
                    else if(j==i) cout<<i-1<<" \n"[j==m];
                    else cout<<j<<" \n"[j==m];
               }
               return ;
           }
       }
       cout<<"No"<<"\n";
       
       


} 
signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);
    int t;
    cin>>t;
    while(t--){
        solve();
    }
   
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
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
1 3 2
No
No

result:

ok OK. (3 test cases)

Test #2:

score: -100
Wrong Answer
time: 0ms
memory: 3560kb

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)