QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#798176#9842. Moduleship2077WA 1ms4132kbC++23510b2024-12-04 09:12:002024-12-04 09:12:01

Judging History

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

  • [2024-12-04 09:12:01]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:4132kb
  • [2024-12-04 09:12:00]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
long long x,ans,a[1233];
vector<long long>vec;int n;
int main(){
    scanf("%d",&n);
    for (int i=1;i<=n;i++) scanf("%lld",&a[i]);
    sort(a+1,a+n+1,greater<int>());
    scanf("%lld",&x);vec={x};
    for (int i=1;i<n;i++){
        vector<long long>cur=vec;
        for (auto x:vec) if (x>a[i])
            cur.emplace_back(x%a[i]);
        swap(cur,vec);
    }
    for (auto x:vec) ans=max(ans,x%a[n]);
    printf("%lld\n",ans);
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 1ms
memory: 4116kb

input:

3
5 6 7
15

output:

3

result:

ok single line: '3'

Test #2:

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

input:

4
20 21 22 10
107

output:

9

result:

ok single line: '9'

Test #3:

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

input:

5
5 6 7 8 9
1000000000000

output:

4

result:

ok single line: '4'

Test #4:

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

input:

21
387370091048596 23758943242091 1014205329284566 1140429273127661 47646521198630614 18199351186587118 140264880946836239 2655245896805102 56344740535070 6951532361130740 7919647866064 7816692309555091 147904943861222 2985707194227584 20464369734437689 7043092696894 166312602338536 21129277743988 4...

output:

5100490967171682

result:

wrong answer 1st lines differ - expected: '7040631923013', found: '5100490967171682'