QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#725059#9167. Coprime ArraygzyWA 1ms3760kbC++14763b2024-11-08 16:05:262024-11-08 16:05:28

Judging History

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

  • [2024-11-08 16:05:28]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3760kb
  • [2024-11-08 16:05:26]
  • 提交

answer

#include<bits/stdc++.h>
#define pb push_back
#define pi pair<int,int>
#define F first
#define S second
#define mp make_pair
#define vector basic_string
using namespace std;
using ll = long long;
using db = double;
const int N = 2e5 + 7;
int i, j, k, n, m;
ll s;

vector<int> d;

int main() {
//	freopen(".in", "r", stdin);
//	freopen(".out", "w", stdout);
//	ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
	scanf("%d%d", &n, &m);
	while(1) {
		if(__gcd(m, n + k) == 1) break;
		++k;
	}
	if(__gcd(k, m) == 1) {
		cout << "2\n" << -k-m << " " << n + k + m << "\n";
	} else {
		cout << "3\n";
		for(i = 1; i <= k; i++) {
			if(__gcd(m, i) == 1) break;
		}
		cout << n+m+m << " " << -i-m << " " << -(k-i)-m;
	}
	return 0;
}



Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 1ms
memory: 3760kb

input:

9 6

output:

3
21 -7 -7

result:

wrong answer Element at position 1 is not coprime to x