QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#788445#9810. Obliviate, Then ReincarnateLGyxjWA 0ms3724kbC++14879b2024-11-27 16:58:422024-11-27 16:58:49

Judging History

This is the latest submission verdict.

  • [2024-11-27 16:58:49]
  • Judged
  • Verdict: WA
  • Time: 0ms
  • Memory: 3724kb
  • [2024-11-27 16:58:42]
  • Submitted

answer

//////////////////////////
// Author: lnyxj
// Time: 2024-11-27 16:14:42
///////////////////////////
#include <bits/stdc++.h>
#define xx first
#define yy second
// #define int long long
// #define double long double
using namespace std;
const int N = 2e5 + 5, mod = 998244353, inv2 = mod + 1 >> 1, inf = 0x3f3f3f3f;
typedef unsigned long long ull;
typedef pair<int, int> pii;
typedef long long ll;

int n, m;
int a[N];

void solve() {
	cin >> n >> m;
	if (__gcd(n, m) != 1) {
		cout << "No\n";
		return;
	}
	cout << "Yes\n";
	const int v = n * m;
	for (int i = 1; i <= n; ++ i) 
		cout << ((i - 1) * m + 1) % v << " \n"[i == n];
	for (int i = 1; i <= m; ++ i) 
		cout << ((i - 1) * n + 1) % v << " \n"[i == m];
}

signed main() {
	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	int T = 1;
	cin >> T;
	while (T --) solve();
	return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

3 2 3
1 1
-1 3
1
2
3

output:

Yes
1 4
1 3 5
Yes
0
0
No

result:

wrong answer 2nd words differ - expected: 'Yes', found: '1'