QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#793550#9799. Magical Palettecurtain_cpp#WA 0ms3616kbC++233.7kb2024-11-29 21:02:352024-11-29 21:02:35

Judging History

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

  • [2024-11-29 21:02:35]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3616kb
  • [2024-11-29 21:02:35]
  • 提交

answer

//Not all efforts result in success, but giving up is sure to result in failure.
#include <iostream>
#include <algorithm>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <cmath>
#include <queue>
#include <set>
#include <stack>
#include <unordered_map>
#include <numeric>
#include <bitset>
#include <functional>
#include <iomanip>
#include <cassert>
using namespace std;
typedef long long  LL;
typedef unsigned long long uLL;
typedef pair<LL,LL> PII;
//typedef tuple<LL,LL,LL> tup;
#define make_pair() mk
#define int long long
const int N = 5e4+5;
const double pi = acos(-1);
const double eps = 1e-10;
const int inf = 0x3f3f3f3f;
const LL LLINF = 0x3f3f3f3f3f3f3f3fLL;
#define debug(x) cout<<"[debug]"#x<<"="<<x<<'\n';
#define pdebug(a,b) cout<<(#a)<<':'<<a<<' '<<(#b)<<':'<<b<<'\n'
#define tdebug(a,b,c) cout<<(#a)<<':'<<a<<' '<<(#b)<<':'<<b<<' '<<(#c)<<':'<<c<<'\n'
#define videbug(a) cout<<(#a)<<':';for(int i=0;i<a.size();i++)cout<<' '<<a[i];cout<<'\n';
//   Make bold hypotheses and verify carefully
// - You REALLY need some key observations...
// - Don't trust seemaxgly trival conclusions
// - Do something instead of nothing and stay organized
// - Don't get stuck on one approach
// - Formalization is the death of intuition
template <int T>
struct ModInt {
    const static int MD = T;
    int x;
    ModInt(LL x = 0)
        : x(x % MD) {}
    int get() { return x; }
    ModInt operator+(const ModInt& that) const {
        int x0 = x + that.x;
        return ModInt(x0 < MD ? x0 : x0 - MD);
    }
    ModInt operator-(const ModInt& that) const {
        int x0 = x - that.x;
        return ModInt(x0 < MD ? x0 + MD : x0);
    }
    ModInt operator*(const ModInt& that) const {
        return ModInt((long long)x * that.x % MD);
    }
    ModInt operator/(const ModInt& that) const {
        return *this * that.inverse();
    }
    void operator+=(const ModInt& that) {
        x += that.x;
        if (x >= MD)
            x -= MD;
    }
    void operator-=(const ModInt& that) {
        x -= that.x;
        if (x < 0)
            x += MD;
    }
    void operator*=(const ModInt& that) { x = (long long)x * that.x % MD; }
    void operator/=(const ModInt& that) { *this = *this / that; }
    ModInt inverse() const {
        int a = x, b = MD, u = 1, v = 0;
        while (b) {
            int t = a / b;
            a -= t * b;
            swap(a, b);
            u -= t * v;
            swap(u, v);
        }
        if (u < 0)
            u += MD;
        return u;
    }
    friend ostream& operator<<(ostream& os, ModInt x) {
        os << x.get();
        return os;
    }
};
const int mod=998244353;
typedef ModInt<mod> mint;
const LL mod1=2147483648;
LL gcd(LL a, LL b)
{
   return b ? gcd(b, a % b) : a;
}
inline __int128 read() {
    __int128 x = 0, f = 1; char ch = getchar();
    while (ch > '9' || ch < '0') { if (ch == '-')f = -1; ch = getchar(); }
    while (ch >= '0' && ch <= '9') { x = x * 10 + ch - '0'; ch = getchar(); }
    return x * f;
}
inline void write(__int128 x) {
    if (x < 0) { putchar('-'); x = -x; }
    if (x > 9)write(x / 10);
    putchar(x % 10 + '0');
}
void solve()
{
   int n,m;cin>>n>>m;
   vector<int>a(n+1),b(m+1);
   if(gcd(n,m)!=1){
       cout<<"NO"<<"\n";
       return;
   }
   for(int i=1;i<=n;i++){
      a[i]=1+(i-1)*m;
   }
   for(int i=1;i<=m;i++){
       b[i]=1+(i-1)*n;
   }
   cout<<"YES"<<"\n";
   for(int i=1;i<=n;i++) cout<<a[i]<<" ";
    cout<<'\n';
   for(int j=1;j<=m;j++) cout<<b[j]<<" ";
  cout<<'\n';
}
signed main()
{
  ios::sync_with_stdio(0); cin.tie(0),cout.tie(0);
  int t;t=1;
  cin>>t;
  while(t--) solve();
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

2
2 3
2 2

output:

YES
1 4 
1 3 5 
NO

result:

wrong answer Token parameter [name=verdict] equals to "YES", doesn't correspond to pattern "Yes|No" (test case 1)