Task: | Weak rook |
Sender: | bubu2006 |
Submission time: | 2024-11-18 16:48:22 +0200 |
Language: | C++ (C++20) |
Status: | READY |
Result: | ACCEPTED |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | ACCEPTED | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
#12 | ACCEPTED | 0.00 s | details |
#13 | ACCEPTED | 0.00 s | details |
#14 | ACCEPTED | 0.00 s | details |
#15 | ACCEPTED | 0.00 s | details |
#16 | ACCEPTED | 0.00 s | details |
#17 | ACCEPTED | 0.00 s | details |
#18 | ACCEPTED | 0.00 s | details |
#19 | ACCEPTED | 0.00 s | details |
#20 | ACCEPTED | 0.00 s | details |
#21 | ACCEPTED | 0.00 s | details |
#22 | ACCEPTED | 0.00 s | details |
#23 | ACCEPTED | 0.00 s | details |
#24 | ACCEPTED | 0.00 s | details |
#25 | ACCEPTED | 0.00 s | details |
#26 | ACCEPTED | 0.00 s | details |
#27 | ACCEPTED | 0.00 s | details |
#28 | ACCEPTED | 0.00 s | details |
#29 | ACCEPTED | 0.00 s | details |
#30 | ACCEPTED | 0.00 s | details |
#31 | ACCEPTED | 0.00 s | details |
#32 | ACCEPTED | 0.00 s | details |
#33 | ACCEPTED | 0.00 s | details |
#34 | ACCEPTED | 0.00 s | details |
#35 | ACCEPTED | 0.00 s | details |
#36 | ACCEPTED | 0.00 s | details |
#37 | ACCEPTED | 0.00 s | details |
#38 | ACCEPTED | 0.00 s | details |
#39 | ACCEPTED | 0.00 s | details |
#40 | ACCEPTED | 0.00 s | details |
#41 | ACCEPTED | 0.00 s | details |
#42 | ACCEPTED | 0.00 s | details |
#43 | ACCEPTED | 0.00 s | details |
#44 | ACCEPTED | 0.00 s | details |
#45 | ACCEPTED | 0.00 s | details |
#46 | ACCEPTED | 0.00 s | details |
#47 | ACCEPTED | 0.00 s | details |
#48 | ACCEPTED | 0.00 s | details |
#49 | ACCEPTED | 0.00 s | details |
#50 | ACCEPTED | 0.00 s | details |
#51 | ACCEPTED | 0.00 s | details |
#52 | ACCEPTED | 0.00 s | details |
#53 | ACCEPTED | 0.00 s | details |
#54 | ACCEPTED | 0.00 s | details |
#55 | ACCEPTED | 0.00 s | details |
#56 | ACCEPTED | 0.00 s | details |
#57 | ACCEPTED | 0.00 s | details |
#58 | ACCEPTED | 0.00 s | details |
#59 | ACCEPTED | 0.00 s | details |
#60 | ACCEPTED | 0.00 s | details |
#61 | ACCEPTED | 0.00 s | details |
#62 | ACCEPTED | 0.00 s | details |
#63 | ACCEPTED | 0.00 s | details |
#64 | ACCEPTED | 0.00 s | details |
#65 | ACCEPTED | 0.01 s | details |
#66 | ACCEPTED | 0.01 s | details |
#67 | ACCEPTED | 0.01 s | details |
#68 | ACCEPTED | 0.01 s | details |
#69 | ACCEPTED | 0.01 s | details |
#70 | ACCEPTED | 0.02 s | details |
#71 | ACCEPTED | 0.02 s | details |
#72 | ACCEPTED | 0.02 s | details |
#73 | ACCEPTED | 0.02 s | details |
#74 | ACCEPTED | 0.02 s | details |
Code
#pragma GCC optimize("O3,unroll-loops") #include <bits/stdc++.h> using namespace std; #define int long long #define rep(i, a, b) for(int i = a; i < (b); ++i) #define all(x) begin(x), end(x) #define sz(x) (int)(x).size() typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef long double ld; string to_string(string s) { return '"' + s + '"'; } string to_string(const char* s) { return to_string((string) s); } string to_string(bool b) { return (b ? "true" : "false"); } template <typename A, typename B> string to_string(pair<A, B> p) { return "(" + to_string(p.first) + ", " + to_string(p.second) + ")"; } template <typename A> string to_string(A v) { bool first = true; string res = "{"; for (const auto &x : v) { if (!first) { res += ", "; } first = false; res += to_string(x); } res += "}"; return res; } void debug_out() { cerr << endl; } template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { cerr << " " << to_string(H); debug_out(T...); } #ifdef LOCAL #define debug(...) cerr << "[" << #__VA_ARGS__ << "]:", debug_out(__VA_ARGS__) #else #define debug(...) 42 #endif ll euclid(ll a, ll b, ll &x, ll &y) { if (!b) return x = 1, y = 0, a; ll d = euclid(b, a % b, y, x); return y -= a/b * x, d; } const ll mod = 998244353; // change to something else struct Mod { ll x; Mod(ll xx) : x(xx) {} Mod operator+(Mod b) { return Mod((x + b.x) % mod); } Mod operator-(Mod b) { return Mod((x - b.x + mod) % mod); } Mod operator*(Mod b) { return Mod((x * b.x) % mod); } Mod operator/(Mod b) { return *this * invert(b); } Mod invert(Mod a) { ll x, y, g = euclid(a.x, mod, x, y); assert(g == 1); return Mod((x + mod) % mod); } Mod operator^(ll e) { if (!e) return Mod(1); Mod r = *this ^ (e / 2); r = r * r; return e&1 ? *this * r : r; } }; void solve(){ int n,y; cin>>n>>y; vi a(n); int g=0; rep(i,0,n){ cin>>a[i]; g=gcd(g,a[i]); } if(y%g==0)cout<<"Yes"; else cout<<"No"; } signed main() { cin.tie(0)->sync_with_stdio(0); cin.exceptions(cin.failbit); // RTE if input wrong datatype int t=1; // cin>>t; while(t--){ solve(); } }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 9 95 |
correct output |
---|
No |
user output |
---|
No |
Test 2
Verdict: ACCEPTED
input |
---|
1 9 2 |
correct output |
---|
No |
user output |
---|
No |
Test 3
Verdict: ACCEPTED
input |
---|
1 85 85 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 4
Verdict: ACCEPTED
input |
---|
1 86426376 172852752 |
correct output |
---|
No |
user output |
---|
No |
Test 5
Verdict: ACCEPTED
input |
---|
2 8 10 8 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 6
Verdict: ACCEPTED
input |
---|
2 9 43972028 43972028 |
correct output |
---|
No |
user output |
---|
No |
Test 7
Verdict: ACCEPTED
input |
---|
2 31 62 62 |
correct output |
---|
No |
user output |
---|
No |
Test 8
Verdict: ACCEPTED
input |
---|
2 20 10 6 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 9
Verdict: ACCEPTED
input |
---|
2 22 44 44 |
correct output |
---|
No |
user output |
---|
No |
Test 10
Verdict: ACCEPTED
input |
---|
3 9 10 8 10 |
correct output |
---|
No |
user output |
---|
No |
Test 11
Verdict: ACCEPTED
input |
---|
3 9 96 96 96 |
correct output |
---|
No |
user output |
---|
No |
Test 12
Verdict: ACCEPTED
input |
---|
3 12 1 8 9 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 13
Verdict: ACCEPTED
input |
---|
3 61518795 123037590 123037590 123037590 |
correct output |
---|
No |
user output |
---|
No |
Test 14
Verdict: ACCEPTED
input |
---|
3 5 1 9 9 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 15
Verdict: ACCEPTED
input |
---|
2 48 96 96 |
correct output |
---|
No |
user output |
---|
No |
Test 16
Verdict: ACCEPTED
input |
---|
2 28 56 56 |
correct output |
---|
No |
user output |
---|
No |
Test 17
Verdict: ACCEPTED
input |
---|
2 97550429 97550429 97550429 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 18
Verdict: ACCEPTED
input |
---|
2 11 89 89 |
correct output |
---|
No |
user output |
---|
No |
Test 19
Verdict: ACCEPTED
input |
---|
2 14 7 7 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 20
Verdict: ACCEPTED
input |
---|
3 4 1 1 7 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 21
Verdict: ACCEPTED
input |
---|
3 4 5 8 9 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 22
Verdict: ACCEPTED
input |
---|
3 18096412 36192824 36192824 36192824 |
correct output |
---|
No |
user output |
---|
No |
Test 23
Verdict: ACCEPTED
input |
---|
3 11 38 38 38 |
correct output |
---|
No |
user output |
---|
No |
Test 24
Verdict: ACCEPTED
input |
---|
3 17 9 2 6 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 25
Verdict: ACCEPTED
input |
---|
4 9 10 8 10 1 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 26
Verdict: ACCEPTED
input |
---|
4 9 45 45 45 45 |
correct output |
---|
No |
user output |
---|
No |
Test 27
Verdict: ACCEPTED
input |
---|
4 12 1 8 9 3 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 28
Verdict: ACCEPTED
input |
---|
4 20 140955392 140955392 140955392 ... |
correct output |
---|
No |
user output |
---|
No |
Test 29
Verdict: ACCEPTED
input |
---|
4 5 1 9 9 3 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 30
Verdict: ACCEPTED
input |
---|
5 9 10 8 10 1 2 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 31
Verdict: ACCEPTED
input |
---|
5 9 2 1 10 6 10 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 32
Verdict: ACCEPTED
input |
---|
5 12 88295480 88295480 88295480 882... |
correct output |
---|
No |
user output |
---|
No |
Test 33
Verdict: ACCEPTED
input |
---|
5 20 60359262 60359262 60359262 603... |
correct output |
---|
No |
user output |
---|
No |
Test 34
Verdict: ACCEPTED
input |
---|
5 99 99 99 99 99 99 |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 35
Verdict: ACCEPTED
input |
---|
10 417021999 997184809 720324490 932557362 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 36
Verdict: ACCEPTED
input |
---|
10 435994903 185082082 25926228 931540864 5... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 37
Verdict: ACCEPTED
input |
---|
10 550797905 70724881 708147823 839949043 2... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 38
Verdict: ACCEPTED
input |
---|
10 967029839 900621455 547232254 172695325 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 39
Verdict: ACCEPTED
input |
---|
10 196621664 49155416 835642072 786486656 3... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 40
Verdict: ACCEPTED
input |
---|
100 417021999 997184809 720324490 932557362 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 41
Verdict: ACCEPTED
input |
---|
100 435994884 185082066 25926212 931540844 5... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 42
Verdict: ACCEPTED
input |
---|
100 550797905 70724850 708147800 839949000 2... |
correct output |
---|
No |
user output |
---|
No |
Test 43
Verdict: ACCEPTED
input |
---|
100 967029839 900621455 547232254 172695325 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 44
Verdict: ACCEPTED
input |
---|
100 221993172 55180121 870732304 831327840 3... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 45
Verdict: ACCEPTED
input |
---|
1000 180269695 68306839 19475202 194115593 72... |
correct output |
---|
No |
user output |
---|
No |
Test 46
Verdict: ACCEPTED
input |
---|
1000 154162842 446221746 740049692 873387158 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 47
Verdict: ACCEPTED
input |
---|
1000 777702400 607341320 237541200 859434000 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 48
Verdict: ACCEPTED
input |
---|
1000 513482004 920566836 772535988 658428876 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 49
Verdict: ACCEPTED
input |
---|
1000 848817694 813580451 178895924 591354998 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 50
Verdict: ACCEPTED
input |
---|
1000 607412037 105636876 158455314 264092190 ... |
correct output |
---|
No |
user output |
---|
No |
Test 51
Verdict: ACCEPTED
input |
---|
1000 375057125 707575540 640304620 313920847 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 52
Verdict: ACCEPTED
input |
---|
1000 851985493 123192958 73903599 127631563 8... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 53
Verdict: ACCEPTED
input |
---|
1000 151631969 126418774 868745277 791821142 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 54
Verdict: ACCEPTED
input |
---|
1000 196092300 291566900 702774400 371456400 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 55
Verdict: ACCEPTED
input |
---|
1000 95549203 430019348 925003626 255457566 ... |
correct output |
---|
No |
user output |
---|
No |
Test 56
Verdict: ACCEPTED
input |
---|
1000 79140426 236255163 217522690 571460714 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 57
Verdict: ACCEPTED
input |
---|
1000 981035661 719087312 821247849 495848292 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 58
Verdict: ACCEPTED
input |
---|
1000 151197835 530814538 122812139 317928176 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 59
Verdict: ACCEPTED
input |
---|
1000 401784348 321879453 663365514 253894053 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 60
Verdict: ACCEPTED
input |
---|
1000 838888356 877465120 478931880 934942330 ... |
correct output |
---|
No |
user output |
---|
No |
Test 61
Verdict: ACCEPTED
input |
---|
1000 59986888 112756706 31053551 245978320 6... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 62
Verdict: ACCEPTED
input |
---|
1000 246908805 481360546 799505092 360715440 ... |
correct output |
---|
No |
user output |
---|
No |
Test 63
Verdict: ACCEPTED
input |
---|
1000 448688751 695523111 690101138 4718705 56... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 64
Verdict: ACCEPTED
input |
---|
1000 255260751 894709657 648628357 584397616 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 65
Verdict: ACCEPTED
input |
---|
10000 48724830 799271756 289109506 679842084 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 66
Verdict: ACCEPTED
input |
---|
10000 701962979 481681060 730506644 420538032 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 67
Verdict: ACCEPTED
input |
---|
10000 517297884 669097120 946962605 184988486 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 68
Verdict: ACCEPTED
input |
---|
10000 960017302 699512050 52854618 999867295 3... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 69
Verdict: ACCEPTED
input |
---|
10000 870124133 696065977 582276932 278838947 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 70
Verdict: ACCEPTED
input |
---|
100000 286053826 28991600 958105500 322333000 7... |
correct output |
---|
No |
user output |
---|
No |
Test 71
Verdict: ACCEPTED
input |
---|
100000 858889273 59656511 421037985 330388054 9... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 72
Verdict: ACCEPTED
input |
---|
100000 248510127 689682575 449975422 669281141 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 73
Verdict: ACCEPTED
input |
---|
100000 38561680 195763855 780100460 423375572 ... |
correct output |
---|
Yes |
user output |
---|
Yes |
Test 74
Verdict: ACCEPTED
input |
---|
100000 458054905 449795038 308349580 231487025 ... |
correct output |
---|
Yes |
user output |
---|
Yes |