답안 #614496

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
614496 2022-07-31T03:30:25 Z 1bin Strongbox (POI11_sej) C++14
70 / 100
1000 ms 2412 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);
        }
    sort(all(d));
    for(ll x : d) if(chk(x)) {
        cout << n / x; break;
    }
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 10 ms 320 KB Output is correct
4 Correct 9 ms 428 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 70 ms 564 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 212 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 88 ms 316 KB Output is correct
4 Correct 51 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 316 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 69 ms 688 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 340 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 85 ms 540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 3 ms 212 KB Output is correct
3 Correct 63 ms 320 KB Output is correct
4 Correct 90 ms 572 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 94 ms 1092 KB Output is correct
2 Correct 33 ms 1108 KB Output is correct
3 Execution timed out 1078 ms 1248 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 63 ms 1868 KB Output is correct
2 Correct 44 ms 1828 KB Output is correct
3 Execution timed out 1073 ms 2108 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 77 ms 2160 KB Output is correct
2 Correct 51 ms 2212 KB Output is correct
3 Execution timed out 1068 ms 2400 KB Time limit exceeded
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 68 ms 2268 KB Output is correct
2 Correct 52 ms 2216 KB Output is correct
3 Execution timed out 1093 ms 2412 KB Time limit exceeded
4 Halted 0 ms 0 KB -