QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#245244 | #7738. Equivalent Rewriting | FHQY_WWW# | WA | 1ms | 3436kb | C++20 | 1.1kb | 2023-11-09 20:02:55 | 2023-11-09 20:02:56 |
Judging History
answer
#include <bits/stdc++.h>
#define int long long
#define AC return 0;
#define pii pair<int, int>
#define all(tar) tar.begin(), tar.end()
using namespace std;
#define endl "\n"
const int mod = 1e9 + 7;
const int maxx = 1e6 + 5;
int n, m, t;
pii p[maxx];
void solve() {
int n, m;
cin >> n >> m;
map<int, int>mp, pre;
int flagg = 0;
for (int i = 1; i <= n; i++) {
int mm;
cin >> mm;
int flag = 1;
for (int j = 1; j <= mm; j++) {
int cache;
cin >> cache;
if (pre.count(cache)) flag = 0;
mp[cache] = 1;
}
pre = mp;
mp.clear();
if (i != 1 && flag && flagg == 0) {
flagg = i;
}
}
if (n == 1 || flagg == 0) {
cout << "No" << endl;
return;
}
cout << "Yes" << endl;
for (int i = 1; i <= n; i++) {
if (i == flagg) {
cout << i - 1 << " ";
continue;
}
if (i + 1 == flagg) {
cout << i + 1 << " ";
continue;
}
cout << i << " ";
}
cout << endl;
}
signed main() {
cin.tie(0);
cout.tie(0);
ios::sync_with_stdio(false);
cin >> t;
while (t--) {
solve();
}
AC
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3436kb
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: 1ms
memory: 3408kb
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)