QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#511970#9167. Coprime Arrayucup-team3877#WA 0ms3612kbC++20729b2024-08-10 13:08:512024-08-10 13:08:51

Judging History

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

  • [2024-08-11 17:38:28]
  • hack成功,自动添加数据
  • (/hack/775)
  • [2024-08-10 13:08:51]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3612kb
  • [2024-08-10 13:08:51]
  • 提交

answer

#include <bits/stdc++.h>
using namespace std;
#define all(v) (v).begin(),(v).end()
#define pb(a) push_back(a)
#define rep(i, n) for(int i=0;i<n;i++)
#define foa(e, v) for(auto& e : v)
using ll = long long;
const ll MOD7 = 1000000007, MOD998 = 998244353, INF = (1LL << 60);
#define dout(a) cout<<fixed<<setprecision(10)<<a<<endl;

int main() {
    cin.tie(0);
    ios::sync_with_stdio(false);

    ll s, x;
    cin >> s >> x;
    vector<ll> v;
    while(1) {
        v.pb(1);
        s --;
        if(__gcd(s, x) == 1) {
            v.pb(s);
            cout << v.size() << endl;
            foa(e, v) cout << e << " ";
            cout << endl;
            return 0;
        }
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

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

input:

9 6

output:

3
1 1 7 

result:

ok Correct

Test #2:

score: 0
Accepted
time: 0ms
memory: 3596kb

input:

14 34

output:

2
1 13 

result:

ok Correct

Test #3:

score: -100
Wrong Answer
time: 0ms
memory: 3612kb

input:

1000000000 223092870

output:

4
1 1 1 999999997 

result:

wrong answer Jury's answer is better than participant's