QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#797695#9799. Magical PaletteDjangle162857RE 0ms0kbC++231.7kb2024-12-03 16:46:092024-12-03 16:46:10

Judging History

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

  • [2024-12-03 16:46:10]
  • 评测
  • 测评结果:RE
  • 用时:0ms
  • 内存:0kb
  • [2024-12-03 16:46:09]
  • 提交

answer

#define LOCAL
#include <bits/stdc++.h>
#define fir first
#define sec second
#define el '\n'

#ifdef LOCAL
#define FINISH cerr << "FINISH" << endl;
#else
#define FINISH ;
#endif

#ifdef LOCAL
#define debug(x) cerr << setw(4) << #x << " == " << x << endl
#else
#define debug(x)
#endif

#ifdef LOCAL
#define debugv(x)                   \
    cerr << setw(4) << #x << ":: "; \
    for (auto i : x)                \
        cerr << i << " ";           \
    cerr << endl
#else
#define debugv(x)
#endif

using namespace std;
typedef long long ll;
typedef pair<int, int> PII;
ostream& operator<<(ostream& out, PII& x)
{
    out << x.fir << " " << x.sec << endl;
    return out;
}
#define int long long
const int mod = 998244353;
const int inf = 0x3f3f3f3f;
const int N = 200020;
void solve()
{
    int n, m;
    cin >> n >> m;
    vector<int> vis(n * m + 1, 0);
    vector<int> a(n + 1, 0);
    vector<int> b(m + 1, 0);
    for (int i = 1 ;i <= n; i++) {
    		a[i] = (i - 1) * m + 1;
    }
    for (int i = 1; i <= m; i++) {
    		b[i] = (i - 1) * n + 1;
    }
    int flg;
    for (int i = 1; i <= n; i++) {
    	for (int j = 1; j <= m; j++) {
    		if (vis[a[i] * b[j] % (n * m)] == 2) {
    			cout << "No" << el;
    			return;
    		}
    	}
    }
    assert(__gcd(n, m) == 1);
    cout << "Yes" << el;
     for (int i = 1; i <= n; i++) {
    	cout << a[i] % (n * m) << " ";
    }
    cout << el;
    for (int j = 1; j <= m; j++) {
    	cout << b[j] % (n * m) << " ";
    }
    cout << el;
   
}
signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    cout.tie(nullptr);
    int T = 1;
    cin >> T;
    while (T--) {
        solve();
    }
    return 0;
}

详细

Test #1:

score: 0
Runtime Error

input:

2
2 3
2 2

output:


result: