답안 #614567

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
614567 2022-07-31T03:58:53 Z 1bin Strongbox (POI11_sej) C++14
100 / 100
193 ms 2732 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], sz;
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 < sz; 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);
    for(int i = 0; i < k - 1; i++) if(m[i] != m[i + 1]) m[sz++] = m[i];
    
    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 1 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 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 340 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 292 KB Output is correct
3 Correct 2 ms 340 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 8 ms 212 KB Output is correct
4 Correct 10 ms 340 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 1 ms 212 KB Output is correct
4 Correct 71 ms 560 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 22 ms 316 KB Output is correct
2 Correct 1 ms 340 KB Output is correct
3 Correct 90 ms 212 KB Output is correct
4 Correct 52 ms 544 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 69 ms 320 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 812 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 1 ms 212 KB Output is correct
4 Correct 87 ms 540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 4 ms 212 KB Output is correct
3 Correct 64 ms 212 KB Output is correct
4 Correct 86 ms 548 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 93 ms 1088 KB Output is correct
2 Correct 29 ms 1108 KB Output is correct
3 Correct 102 ms 1420 KB Output is correct
4 Correct 157 ms 1868 KB Output is correct
5 Correct 139 ms 1500 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 62 ms 1852 KB Output is correct
2 Correct 45 ms 1820 KB Output is correct
3 Correct 100 ms 2164 KB Output is correct
4 Correct 128 ms 1740 KB Output is correct
5 Correct 155 ms 2184 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 83 ms 2264 KB Output is correct
2 Correct 54 ms 2208 KB Output is correct
3 Correct 153 ms 2412 KB Output is correct
4 Correct 185 ms 2508 KB Output is correct
5 Correct 167 ms 2732 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 76 ms 2160 KB Output is correct
2 Correct 53 ms 2252 KB Output is correct
3 Correct 132 ms 2480 KB Output is correct
4 Correct 190 ms 2648 KB Output is correct
5 Correct 193 ms 2628 KB Output is correct