QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#789785#9799. Magical Palettemanba_outWA 28ms3648kbC++201.1kb2024-11-27 21:51:382024-11-27 21:51:44

Judging History

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

  • [2024-11-27 21:51:44]
  • 评测
  • 测评结果:WA
  • 用时:28ms
  • 内存:3648kb
  • [2024-11-27 21:51:38]
  • 提交

answer

#include<bits/stdc++.h>
#define INF 0x3f3f3f3f
#define lowbit(x) = ((x)& - (x))
#define rep(a,b,c) for(int a=b;a<=c;a++)
#define per(a,b,c) for(int a=b;a>=c;a--)
#define x first
#define y second
using namespace std;
typedef long long ll;

ll fastPow(ll a, ll n, ll mod){
    ll ans = 1;
    a %= mod;
    while(n) {
        if(n & 1)   ans = (ans*a) % mod;
        a = (a*a) % mod;
        n >>= 1;
    }
    return ans;
}

int gcd(int a, int b) {
  while (b != 0) {
    int tmp = a;
    a = b;
    b = tmp % b;
  }
  return a;
}

/*int sum(int x){
	int ans = 0;
	while(x>0){
		ans+=tree[x];
		x-=lowbit(x);
	}
	return ans;
}

void update(int x,int d){
	while(x<=//N){
		tree[x]+=d;
		x+=lowbit(x)
	}
}*/
const int N = 1e6+5;
int a[N],b[N];
int main(){
	ios::sync_with_stdio(0),cin.tie(0),cout.tie(0);
	int t;cin>>t;
	int m,n;
	while(t--){
		cin>>n>>m;
		if(gcd(n,m)!=1){
			cout<<"No\n";
			continue;
		}
		cout<<"Yes\n";
		rep(i,0,n-1)cout<<1+i*m<<' ';cout<<'\n';
		rep(i,0,m-1)cout<<1+i*n<<' ';cout<<'\n';
		
	}
	return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3624kb

input:

2
2 3
2 2

output:

Yes
1 4 
1 3 5 
No

result:

ok 2 cases (2 test cases)

Test #2:

score: -100
Wrong Answer
time: 28ms
memory: 3648kb

input:

1
1 1000000

output:

Yes
1 
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 1...

result:

wrong answer Integer parameter [name=b[1000000]] equals to 1000000, violates the range [0, 999999] (test case 1)