답안 #97993

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
97993 2019-02-19T17:33:51 Z brcode Strongbox (POI11_sej) C++14
21 / 100
161 ms 8500 KB
#include <iostream>
#include <algorithm>
#include <cmath>
using namespace std;
int ans;
int total;
const int MAXN = 1e6;
int arr[MAXN];
bool common(int x){
    for(int i=1;i<=total;i++){
        if(arr[i]%x == 0){
            return false;
        }
       
    }
     return true;
}
int main() {
    int n,k;
    cin>>n>>k;
    for(int i=1;i<=k;i++){
        cin>>arr[i];
    }
    for(int i=1;i<=k;i++){
        arr[i] = __gcd(n,arr[i]);
    }
    sort(arr+1,arr+k);
    for(int i=1;i<k;i++){
        if(arr[i]!=arr[i-1]){
            total++;
            arr[total] = arr[i];
        }
    }
  
    for(int i=1;i<=sqrt(arr[k]);i++){
        if(arr[k]%i == 0){
            
            if(common(i)){
                ans = n/i;
                break;
            }
            if(common(arr[k]/i)){
                ans = (n/arr[k]*i);
            }
        }
    }
    cout<<ans<<endl;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 1 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
4 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 384 KB Output is correct
2 Correct 3 ms 256 KB Output is correct
3 Correct 3 ms 512 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 2 ms 384 KB Output is correct
3 Correct 2 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 98 ms 8248 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 109 ms 8276 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 113 ms 8304 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 90 ms 8252 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 161 ms 8500 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 94 ms 8312 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 124 ms 8248 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 101 ms 8228 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 123 ms 8388 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 117 ms 8380 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 111 ms 8260 KB Execution killed with signal 11 (could be triggered by violating memory limits)
2 Halted 0 ms 0 KB -