QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#267403#7738. Equivalent Rewritingtonylin1026WA 0ms3464kbC++231.1kb2023-11-27 11:11:022023-11-27 11:11:03

Judging History

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

  • [2023-11-27 11:11:03]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3464kb
  • [2023-11-27 11:11:02]
  • 提交

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;
}

详细

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3464kb

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
2 1 3
Yes
2 1
No

result:

wrong answer two transactions are not equivalent. (test case 1)