QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#267405 | #7738. Equivalent Rewriting | tonylin1026 | WA | 0ms | 3572kb | C++23 | 1.1kb | 2023-11-27 11:11:42 | 2023-11-27 11:11:43 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m;
cin >> n >> m;
vector<int> now(m + 1), ind(n + 1);
vector<set<int, greater<int>>> to(n + 1);
for (int i = 1; i <= n; i++) {
int p;
cin >> p;
for (int j = 1; j <= p; j++) {
int x;
cin >> x;
if (now[x] && to[now[x]].find(i) == to[now[x]].end()) {
to[now[x]].insert(i);
ind[i]++;
}
now[x] = i;
}
}
for (int i = 1; i < n; i++) {
if (to[i].find(i + 1) == to[i].end()) {
cout << "Yes\n";
for (int j = 1; j <= n; j++) {
if (j == i + 1) {
cout << i << " \n"[j == n];
} else if (j == i) {
cout << i + 1 << " ";
} else
cout << j << " \n"[j == n];
}
return;
}
}
cout << "No\n";
return;
}
int main() {
int t;
cin >> t;
while (t--) {
solve();
}
return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3508kb
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: 3572kb
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)