CSES - Aalto Competitive Programming 2024 - wk11 - Wed - Results
Submission details
Task:Super knight
Sender:aalto2024l_005
Submission time:2024-11-20 17:54:20 +0200
Language:C++ (C++17)
Status:READY
Result:
Test results
testverdicttime
#1ACCEPTED0.00 sdetails
#2ACCEPTED0.00 sdetails
#30.00 sdetails
#4ACCEPTED0.00 sdetails
#50.00 sdetails
#6ACCEPTED0.00 sdetails
#7ACCEPTED0.00 sdetails
#8ACCEPTED0.00 sdetails
#9ACCEPTED0.00 sdetails
#10ACCEPTED0.00 sdetails
#11ACCEPTED0.00 sdetails
#12ACCEPTED0.00 sdetails
#13ACCEPTED0.00 sdetails
#14ACCEPTED0.00 sdetails
#15ACCEPTED0.00 sdetails
#16ACCEPTED0.00 sdetails
#17ACCEPTED0.00 sdetails
#18ACCEPTED0.00 sdetails
#19ACCEPTED0.00 sdetails
#20ACCEPTED0.00 sdetails
#21ACCEPTED0.00 sdetails
#22ACCEPTED0.00 sdetails
#230.00 sdetails
#24ACCEPTED0.00 sdetails
#25ACCEPTED0.00 sdetails
#26ACCEPTED0.00 sdetails
#27ACCEPTED0.00 sdetails
#28ACCEPTED0.00 sdetails
#29ACCEPTED0.00 sdetails
#30ACCEPTED0.00 sdetails
#31ACCEPTED0.00 sdetails
#32ACCEPTED0.00 sdetails
#330.00 sdetails
#34ACCEPTED0.00 sdetails
#350.00 sdetails
#36ACCEPTED0.00 sdetails
#37ACCEPTED0.00 sdetails
#38ACCEPTED0.00 sdetails
#39ACCEPTED0.00 sdetails
#40ACCEPTED0.00 sdetails
#41ACCEPTED0.00 sdetails
#42ACCEPTED0.00 sdetails
#43ACCEPTED0.00 sdetails
#44ACCEPTED0.00 sdetails
#45ACCEPTED0.00 sdetails
#46ACCEPTED0.01 sdetails
#47ACCEPTED0.00 sdetails
#48ACCEPTED0.01 sdetails
#49ACCEPTED0.00 sdetails
#50ACCEPTED0.00 sdetails
#51ACCEPTED0.00 sdetails
#52ACCEPTED0.00 sdetails
#53ACCEPTED0.00 sdetails
#54ACCEPTED0.00 sdetails
#55ACCEPTED0.00 sdetails
#56ACCEPTED0.00 sdetails
#57ACCEPTED0.00 sdetails
#58ACCEPTED0.00 sdetails
#59ACCEPTED0.00 sdetails
#60ACCEPTED0.01 sdetails
#61ACCEPTED0.00 sdetails
#62ACCEPTED0.00 sdetails
#63ACCEPTED0.00 sdetails
#64ACCEPTED0.00 sdetails
#65ACCEPTED0.00 sdetails
#66ACCEPTED0.01 sdetails
#67ACCEPTED0.01 sdetails
#68ACCEPTED0.01 sdetails
#69ACCEPTED0.01 sdetails
#70ACCEPTED0.01 sdetails
#71ACCEPTED0.06 sdetails
#72ACCEPTED0.06 sdetails
#73ACCEPTED0.06 sdetails
#74ACCEPTED0.06 sdetails
#75ACCEPTED0.06 sdetails

Code

#include <iostream>
#include <vector>
#include <algorithm>
#include <numeric>

using namespace std;

typedef long long ll;

int main() {
    int n;
    ll x, y;
    cin >> n >> x >> y;
    vector<ll> a(n);
    for (int i = 0; i < n; ++i) {
        cin >> a[i];
    }

    if (n == 1) {
        cout << "No" << endl;
        return 0;
    }

    sort(a.begin(), a.end());
    ll gcd_d = a[1] - a[0];
    for (int i = 2; i < n; ++i) {
        gcd_d = __gcd(gcd_d, a[i] - a[i - 1]);
    }

    if (gcd_d == 0) {
        cout << "No" << endl;
        return 0;
    }

    if ( (x % gcd_d == 0) && (y % gcd_d == 0) ) {
        cout << "Yes" << endl;
    } else {
        cout << "No" << endl;
    }

    return 0;
}

Test details

Test 1

Verdict: ACCEPTED

input
1 5 10

correct output
No

user output
No

Test 2

Verdict: ACCEPTED

input
1 5 2
112 

correct output
No

user output
No

Test 3

Verdict:

input
1 31 31
31 

correct output
Yes

user output
No

Test 4

Verdict: ACCEPTED

input
1 10 10

correct output
No

user output
No

Test 5

Verdict:

input
1 22 22
22 

correct output
Yes

user output
No

Test 6

Verdict: ACCEPTED

input
2 5 10
8 10 

correct output
No

user output
No

Test 7

Verdict: ACCEPTED

input
2 5 2
96 96 

correct output
No

user output
No

Test 8

Verdict: ACCEPTED

input
2 6 1
8 9 

correct output
Yes

user output
Yes

Test 9

Verdict: ACCEPTED

input
2 87 87
174 174 

correct output
No

user output
No

Test 10

Verdict: ACCEPTED

input
2 3 1
9 9 

correct output
No

user output
No

Test 11

Verdict: ACCEPTED

input
3 5 10
8 10 1 

correct output
Yes

user output
Yes

Test 12

Verdict: ACCEPTED

input
3 5 2
45 45 45 

correct output
No

user output
No

Test 13

Verdict: ACCEPTED

input
3 6 1
8 9 3 

correct output
Yes

user output
Yes

Test 14

Verdict: ACCEPTED

input
3 73 73
146 146 146 

correct output
No

user output
No

Test 15

Verdict: ACCEPTED

input
3 3 1
9 9 3 

correct output
No

user output
No

Test 16

Verdict: ACCEPTED

input
2 2 1
1 7 

correct output
No

user output
No

Test 17

Verdict: ACCEPTED

input
2 2 5
8 9 

correct output
Yes

user output
Yes

Test 18

Verdict: ACCEPTED

input
2 8 7
182 182 

correct output
No

user output
No

Test 19

Verdict: ACCEPTED

input
2 6 10
38 38 

correct output
No

user output
No

Test 20

Verdict: ACCEPTED

input
2 9 9
2 6 

correct output
No

user output
No

Test 21

Verdict: ACCEPTED

input
3 2 1
1 7 5 

correct output
No

user output
No

Test 22

Verdict: ACCEPTED

input
3 2 5
8 9 3 

correct output
Yes

user output
Yes

Test 23

Verdict:

input
3 98 98
98 98 98 

correct output
Yes

user output
No

Test 24

Verdict: ACCEPTED

input
3 6 10
8 7 9 

correct output
Yes

user output
Yes

Test 25

Verdict: ACCEPTED

input
3 9 9
2 6 1 

correct output
Yes

user output
Yes

Test 26

Verdict: ACCEPTED

input
4 5 10
8 10 1 2 

correct output
Yes

user output
Yes

Test 27

Verdict: ACCEPTED

input
4 5 2
1 10 6 10 

correct output
Yes

user output
Yes

Test 28

Verdict: ACCEPTED

input
4 6 1
116 116 116 116 

correct output
No

user output
No

Test 29

Verdict: ACCEPTED

input
4 62 62
124 124 124 124 

correct output
No

user output
No

Test 30

Verdict: ACCEPTED

input
4 3 1
99 99 99 99 

correct output
No

user output
No

Test 31

Verdict: ACCEPTED

input
5 5 10
16 16 16 16 16 

correct output
No

user output
No

Test 32

Verdict: ACCEPTED

input
5 5 2
1 10 6 10 5 

correct output
Yes

user output
Yes

Test 33

Verdict:

input
5 91 91
91 91 91 91 91 

correct output
Yes

user output
No

Test 34

Verdict: ACCEPTED

input
5 10 10
142 142 142 142 142 

correct output
No

user output
No

Test 35

Verdict:

input
5 50 50
50 50 50 50 50 

correct output
Yes

user output
No

Test 36

Verdict: ACCEPTED

input
10 447773956 773442532
122754 137572548 324627094 157...

correct output
Yes

user output
Yes

Test 37

Verdict: ACCEPTED

input
10 468145963 198730372
27838070 590195580 467423853 5...

correct output
No

user output
No

Test 38

Verdict: ACCEPTED

input
10 591414747 75940263
760367935 901888417 312356591 ...

correct output
Yes

user output
Yes

Test 39

Verdict: ACCEPTED

input
10 967034924 587586158
185430168 918715986 767527812 ...

correct output
No

user output
No

Test 40

Verdict: ACCEPTED

input
10 238363353 59249204
934941692 892631472 221963002 ...

correct output
Yes

user output
Yes

Test 41

Verdict: ACCEPTED

input
100 447773962 773442532
122816 137572579 324627123 157...

correct output
Yes

user output
Yes

Test 42

Verdict: ACCEPTED

input
100 468145963 198730372
27838076 590195590 467423861 5...

correct output
Yes

user output
Yes

Test 43

Verdict: ACCEPTED

input
100 591414747 75940263
760367920 901888400 312356580 ...

correct output
No

user output
No

Test 44

Verdict: ACCEPTED

input
100 967034924 587586158
185430194 918715995 767527830 ...

correct output
Yes

user output
Yes

Test 45

Verdict: ACCEPTED

input
100 238363353 59249204
934941692 892631472 221963002 ...

correct output
Yes

user output
Yes

Test 46

Verdict: ACCEPTED

input
1000 193563111 73343920
20911381 713738007 497377109 2...

correct output
Yes

user output
Yes

Test 47

Verdict: ACCEPTED

input
1000 165531091 479126951
794622300 937792320 282732340 ...

correct output
No

user output
No

Test 48

Verdict: ACCEPTED

input
1000 835051605 652127789
255057939 922810245 885062330 ...

correct output
Yes

user output
Yes

Test 49

Verdict: ACCEPTED

input
1000 551842440 989875540
830179640 707687000 934614600 ...

correct output
No

user output
No

Test 50

Verdict: ACCEPTED

input
1000 911411025 873575332
192088036 634962580 58372034 1...

correct output
No

user output
No

Test 51

Verdict: ACCEPTED

input
1000 657312726 129662684
181537270 324043958 468214806 ...

correct output
Yes

user output
Yes

Test 52

Verdict: ACCEPTED

input
1000 402714522 759753451
687521851 337069943 912780542 ...

correct output
Yes

user output
Yes

Test 53

Verdict: ACCEPTED

input
1000 914812458 132277432
79353385 137043347 960925660 9...

correct output
Yes

user output
Yes

Test 54

Verdict: ACCEPTED

input
1000 162813587 135741125
932808138 850211477 994160127 ...

correct output
Yes

user output
Yes

Test 55

Verdict: ACCEPTED

input
1000 210552500 313067625
754598250 398848375 444198100 ...

correct output
Yes

user output
Yes

Test 56

Verdict: ACCEPTED

input
1000 102595150 461729870
993215160 274295630 368909100 ...

correct output
Yes

user output
Yes

Test 57

Verdict: ACCEPTED

input
1000 84976386 253677050
233563210 613601269 384997082 ...

correct output
Yes

user output
Yes

Test 58

Verdict: ACCEPTED

input
1000 772114122 881808164
532413050 693522980 397009010 ...

correct output
No

user output
No

Test 59

Verdict: ACCEPTED

input
1000 162347439 569957770
131868530 341372779 824691456 ...

correct output
Yes

user output
Yes

Test 60

Verdict: ACCEPTED

input
1000 431412671 345615445
712283313 272616673 2158448 30...

correct output
Yes

user output
Yes

Test 61

Verdict: ACCEPTED

input
1000 900749514 942171039
514249176 442729056 294462840 ...

correct output
No

user output
No

Test 62

Verdict: ACCEPTED

input
1000 64410431 121071591
33343496 264117210 727055618 6...

correct output
Yes

user output
Yes

Test 63

Verdict: ACCEPTED

input
1000 265116311 516856979
858462072 387315344 377287820 ...

correct output
No

user output
No

Test 64

Verdict: ACCEPTED

input
1000 481775878 746812254
740990455 5066671 602160022 41...

correct output
Yes

user output
Yes

Test 65

Verdict: ACCEPTED

input
1000 274084144 960687179
696459395 627492163 271745075 ...

correct output
Yes

user output
Yes

Test 66

Verdict: ACCEPTED

input
10000 52317939 858211636
310429135 729974978 774131725 ...

correct output
Yes

user output
Yes

Test 67

Verdict: ACCEPTED

input
10000 223832798 753727010
517201100 784375537 451549274 ...

correct output
Yes

user output
Yes

Test 68

Verdict: ACCEPTED

input
10000 555444372 718437552
198629856 821906136 839321976 ...

correct output
No

user output
No

Test 69

Verdict: ACCEPTED

input
10000 316145889 751095345
56752214 340900389 236295457 3...

correct output
Yes

user output
Yes

Test 70

Verdict: ACCEPTED

input
10000 934288674 747395152
625215095 465197604 299401040 ...

correct output
Yes

user output
Yes

Test 71

Verdict: ACCEPTED

input
100000 307147957 31129494
346102496 827117209 656524198 ...

correct output
Yes

user output
Yes

Test 72

Verdict: ACCEPTED

input
100000 922225334 64055691
400195554 452086094 596064992 ...

correct output
Yes

user output
Yes

Test 73

Verdict: ACCEPTED

input
100000 266835718 740541026
483157431 718635153 441244325 ...

correct output
Yes

user output
Yes

Test 74

Verdict: ACCEPTED

input
100000 41405289 210199839
837626491 454596059 99539902 4...

correct output
Yes

user output
Yes

Test 75

Verdict: ACCEPTED

input
100000 491832755 482963780
331087868 726411502 248557321 ...

correct output
Yes

user output
Yes