QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#266993 | #7738. Equivalent Rewriting | Cruel_moonlight | WA | 0ms | 3540kb | C++20 | 859b | 2023-11-26 20:51:11 | 2023-11-26 20:51:12 |
Judging History
answer
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
typedef pair<int, int> PII;
void solve() {
int n, m;
cin >> n >> m;
vector<int> a(m + 1);
vector<int> res(n);
iota(res.begin(), res.end(), 1);
int ans = -1;
for(int i = 0; i < n; i ++ ) {
int x;
cin >> x;
vector<int> b(m + 1);
bool flag = true;
for(int j = 0; j < x; j ++ ) {
int p;
cin >> p;
b[p] = 1;
if(a[p] == 1) {
flag = false;
}
}
if(flag) {
ans = i - 1;
}
a = b;
}
if(ans != -1) {
cout << "Yes\n";
swap(res[ans], res[ans + 1]);
for(int i = 0; i < res.size(); i ++ ) {
cout << res[i] << " \n"[i == res.size() - 1];
}
} else {
cout << "No\n";
}
}
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
int _;
cin >> _;
while(_ --) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3540kb
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: 3496kb
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)