QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#245240#7738. Equivalent RewritingFHQY_WWW#WA 0ms3436kbC++201.0kb2023-11-09 20:01:172023-11-09 20:01:17

Judging History

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

  • [2023-11-09 20:01:17]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3436kb
  • [2023-11-09 20:01:17]
  • 提交

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

Details

Tip: Click on the bar to expand more detailed information

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: 0ms
memory: 3400kb

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)