QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#245230#7738. Equivalent RewritingFHQY_WWW#WA 1ms3480kbC++201.0kb2023-11-09 19:54:102023-11-09 19:54:10

Judging History

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

  • [2023-11-09 19:54:10]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3480kb
  • [2023-11-09 19:54:10]
  • 提交

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;
	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 (mp.count(cache)) flag = 0;
			mp[cache] = 1;
		}
		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: 1ms
memory: 3480kb

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: 3448kb

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)