# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
44110 | 2018-03-29T23:57:18 Z | imaxblue | Strongbox (POI11_sej) | C++17 | 1000 ms | 2956 KB |
#include <bits/stdc++.h> using namespace std; #define ll long long #define mp make_pair #define pb push_back #define x first #define y second #define pii pair<int, int> #define p3i pair<pii, int> #define pll pair<ll, ll> #define p3l pair<pll, ll> #define lseg L, (L+R)/2, N*2+1 #define rseg (L+R)/2+1, R, N*2+2 #define ub upper_bound #define lb lower_bound #define pq priority_queue #define MN 1000000007 #define fox(k, x) for (int k=0; k<x; ++k) #define fox1(k, x) for (int k=1; k<=x; ++k) #define foxr(k, x) for (int k=x-1; k>=0; --k) #define fox1r(k, x) for (int k=x; k>0; --k) #define ms multiset #define flood(x) memset(x, 0x3f3f3f3f, sizeof x) #define drain(x) memset(x, 0, sizeof x) #define rng() ((rand() << 14)+rand()) #define scan(X) do{while((X=getchar())<'0'); for(X-='0'; '0'<=(_=getchar()); X=(X<<3)+(X<<1)+_-'0');}while(0) char _; #define pi 3.14159265358979323846 ll gcd(ll x, ll y){return y==0?x:gcd(y, x%y);} vector<ll> f, f2; ll d; ll n, a[250005], k, g; void factor(ll X, vector<ll>&f){ for (ll l=1; l*l<=X; ++l){ if (X%l==0){ f.pb(l); if (l*l!=X) f.pb(X/l); } } sort(f.begin(), f.end()); } bool check(ll G){ fox(l, n){ if ((a[l]%g)%G==0) return 0; } return 1; } set<ll> done; int main(){ scanf("%lli%lli", &d, &n); --n; fox(l, n) scanf("%lli", &a[l]); scanf("%lli", &k); g=gcd(k, d); //return 0; //cout << k << ' ' << d << ' ' << g << endl; factor(g, f); ll ans; foxr(l, f.size()){ if (done.count(f[l])) continue; //cout << f[l] << endl; if (check(f[l])){ ans=d/f[l]; } f2.clear(); factor(f[l], f2); fox(l2, f2.size()){ done.insert(f2[l]); } } cout << ans; return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 376 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
4 | Correct | 2 ms | 488 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 488 KB | Output is correct |
2 | Correct | 2 ms | 488 KB | Output is correct |
3 | Correct | 2 ms | 488 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 488 KB | Output is correct |
2 | Correct | 2 ms | 512 KB | Output is correct |
3 | Correct | 8 ms | 696 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 6 ms | 696 KB | Output is correct |
2 | Correct | 3 ms | 696 KB | Output is correct |
3 | Correct | 64 ms | 696 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 696 KB | Output is correct |
2 | Correct | 2 ms | 696 KB | Output is correct |
3 | Correct | 26 ms | 696 KB | Output is correct |
4 | Correct | 758 ms | 772 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 3 ms | 772 KB | Output is correct |
2 | Correct | 20 ms | 772 KB | Output is correct |
3 | Correct | 2 ms | 772 KB | Output is correct |
4 | Execution timed out | 1075 ms | 1140 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 61 ms | 1140 KB | Output is correct |
2 | Correct | 44 ms | 1140 KB | Output is correct |
3 | Correct | 255 ms | 1140 KB | Output is correct |
4 | Execution timed out | 1081 ms | 1140 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 218 ms | 1140 KB | Output is correct |
2 | Correct | 10 ms | 1140 KB | Output is correct |
3 | Correct | 2 ms | 1140 KB | Output is correct |
4 | Execution timed out | 1062 ms | 1140 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1140 KB | Output is correct |
2 | Correct | 18 ms | 1140 KB | Output is correct |
3 | Correct | 2 ms | 1140 KB | Output is correct |
4 | Execution timed out | 1086 ms | 1140 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 1140 KB | Output is correct |
2 | Correct | 27 ms | 1140 KB | Output is correct |
3 | Correct | 175 ms | 1140 KB | Output is correct |
4 | Execution timed out | 1075 ms | 1152 KB | Time limit exceeded |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 254 ms | 1404 KB | Output is correct |
2 | Correct | 713 ms | 1660 KB | Output is correct |
3 | Execution timed out | 1079 ms | 1788 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 126 ms | 2172 KB | Output is correct |
2 | Correct | 59 ms | 2172 KB | Output is correct |
3 | Execution timed out | 1078 ms | 2428 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 119 ms | 2556 KB | Output is correct |
2 | Correct | 94 ms | 2560 KB | Output is correct |
3 | Execution timed out | 1072 ms | 2856 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 198 ms | 2856 KB | Output is correct |
2 | Correct | 94 ms | 2856 KB | Output is correct |
3 | Execution timed out | 1083 ms | 2956 KB | Time limit exceeded |
4 | Halted | 0 ms | 0 KB | - |