QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#657425#7738. Equivalent RewritingWilliamHuWA 1ms6156kbC++201.3kb2024-10-19 14:44:222024-10-19 14:44:31

Judging History

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

  • [2024-10-19 14:44:31]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:6156kb
  • [2024-10-19 14:44:22]
  • 提交

answer

#include  <bits/stdc++.h>
using namespace std;
const int N =2000006;
int q[N];
int final[N];
int main() {
    int T;
    scanf("%d",&T);
    while(T--) {
        int n,m;scanf("%d%d",&m,&n);
        vector<vector<int> > b(m+1);
        for(int i=1;i<=n;++i)
            final[i]=0;
        for(int i=1;i<=m;++i) {
            scanf("%d",&q[i]);
            b[i].resize(q[i]+1);
            for(int j=1;j<=q[i];++j){
                scanf("%d",&b[i][j]);
                final[b[i][j]]=i;
            }
            sort(b[i].begin()+1,b[i].begin()+1+q[i]);
        }
        if(m==1) printf("No\n");
        bool f;
        int i;
        for(i=2;i<=m;++i) {
            f=0;
            for(int j=1,k=1;j<=q[i],k<=q[i-1];++j){
                int x=b[i][j];
                while(k<=q[i-1] && b[i-1][k]<x) 
                    ++k;
                if(k<=q[i-1] && final[x]==i && b[i-1][k]==x) {
                    f=1;break;
                }
            }
            if(!f) break;
        }
        if(!f&&i<=m) {
            printf("Yes\n");
            for(int l=1;l<i-1;++l) printf("%d ",l);
            printf("%d %d ",i,i-1);
            for(int l=i+1;l<=m;++l) printf("%d ",l);
            printf("\n");

        } else {
            printf("No\n");
        }
    }
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 6156kb

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
No

result:

wrong output format Extra information in the output file (test case 3)