Submission #614490

# Submission time Handle Problem Language Result Execution time Memory
614490 2022-07-31T03:27:02 Z 1bin Strongbox (POI11_sej) C++14
56 / 100
1000 ms 5908 KB
#include <bits/stdc++.h>

using namespace std;

#define all(v) v.begin(), v.end()
typedef long long ll;
const int NMAX = 3e5 + 5;
ll n, x, k, m[NMAX];
vector<ll> d;

ll gcd(ll a, ll b){
    if(!b) return a;
    return gcd(b,  a % b);
}

int chk(ll x){
    for(int i = 0; i < k - 1; i++)
        if(m[i] % x == 0) return 0;
    return 1;
}

int main(void){
    ios::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    
    cin >> n >> k;
    for(int i = 0; i < k; i++) cin >> m[i], m[i] = gcd(m[i], n);
    x = m[k - 1];
    for(ll i = 1; i * i < x; i++)
        if(x % i == 0){
            d.emplace_back(i);
            d.emplace_back(x / i);
        }
    if(x > 1) d.emplace_back(x);
    sort(all(d));
    for(ll x : d) if(chk(x)) {
        cout << n / x; break;
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 220 KB Output is correct
2 Correct 0 ms 332 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 324 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 328 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 2 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 2 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 8 ms 212 KB Output is correct
4 Correct 9 ms 340 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 22 ms 340 KB Output is correct
2 Correct 1 ms 336 KB Output is correct
3 Correct 90 ms 340 KB Output is correct
4 Correct 53 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 66 ms 344 KB Output is correct
2 Correct 1 ms 344 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 67 ms 588 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 344 KB Output is correct
4 Correct 85 ms 676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 340 KB Output is correct
2 Correct 3 ms 340 KB Output is correct
3 Correct 61 ms 340 KB Output is correct
4 Correct 84 ms 704 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 92 ms 2084 KB Output is correct
2 Correct 30 ms 2148 KB Output is correct
3 Execution timed out 1088 ms 2392 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 69 ms 4432 KB Output is correct
2 Correct 44 ms 4688 KB Output is correct
3 Execution timed out 1068 ms 4112 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 77 ms 5112 KB Output is correct
2 Correct 54 ms 5868 KB Output is correct
3 Execution timed out 1095 ms 4872 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 80 ms 4740 KB Output is correct
2 Correct 55 ms 5908 KB Output is correct
3 Execution timed out 1085 ms 5072 KB Time limit exceeded
4 Halted 0 ms 0 KB -