QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#627107#7738. Equivalent Rewritingheige#WA 2ms5992kbC++14959b2024-10-10 14:46:332024-10-10 14:46:35

Judging History

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

  • [2024-10-10 14:46:35]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:5992kb
  • [2024-10-10 14:46:33]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
const int maxn = 100005;
int T, n, m;
vector<int> a[maxn];
bool p[maxn];
int x[maxn];
void work() {
    cin >> m >> n;
    for (int i = 1; i <= m; i++) {
        int k; cin >> k; a[i].clear();
        for (int j = 1; j <= k; j++) {
            int x; cin >> x;
            a[i].push_back(x);
        }
    }
    for (int i = 1; i < m; i++) {
        for (auto x : a[i]) p[x] = 1;
        bool fl = 1;
        for (auto x : a[i + 1]) fl &= !p[x];
        for (auto x : a[i]) p[x] = 0;
        if (fl) {
            cout << "YES" << '\n';
            for (int i = 1; i <= m; i++) x[i] = i;
            swap(x[i], x[i + 1]);
            for (int i = 1; i <= m; i++) cout << x[i] << " \n"[i == m];
            return;
        }
    }
    cout << "NO" << '\n';
}
int main() {
    ios::sync_with_stdio(0), cin.tie(0), cout.tie(0);
    cin >> T;
    while (T--) work();
    return 0;
}

詳細信息

Test #1:

score: 0
Wrong Answer
time: 2ms
memory: 5992kb

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:

wrong answer Token parameter [name=yesno] equals to "YES", doesn't correspond to pattern "Yes|No" (test case 1)