QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#667000 | #7738. Equivalent Rewriting | E_REMAL | WA | 0ms | 3612kb | C++14 | 727b | 2024-10-22 20:43:29 | 2024-10-22 20:43:45 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
const int maxn=1e5+5;
int last[maxn],p[maxn];
int n,m,t,loc;
bool b,ans;
int s,e;
int main()
{
cin>>t;
while(t--) {
cin>>n>>m;
for(int i=1;i<=m;i++) last[i]=0;
ans=0;
s=0;
e=0;
for(int i=1;i<=n;i++) {
cin>>p[i];
b=1;
for(int j=1;j<=p[i];j++) {
cin>>loc;
p[last[loc]]--;
if(i-last[loc]==1) b=0;
last[loc]=i;
}
if(b==1) {
s=i-1;
e=i;
ans=1;
}
}
if(ans) {
cout<<"Yes"<<endl;
for(int i=1;i<=n;i++) {
if(i==s) cout<<e;
else if(i==e) cout<<s;
else cout<<i;
if(i!=n) cout<<' ';
}
cout<<endl;
}
else cout<<"No"<<endl;
}
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 0ms
memory: 3612kb
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: 3564kb
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)