AtCoder Grand Contest 018

Submission #5884746

Source codeソースコード

#include <bits/stdc++.h>
using namespace std;

unsigned euclidean_gcd(unsigned a, unsigned b) {
  if(a < b) return euclidean_gcd(b, a);
  unsigned r;
  while ((r=a%b)) {
    a = b;
    b = r;
  }
  return b;
}

int main() {
  int N,K;
  cin >> N >> K;
  int a[N];
  cin >> a[0];
  int ma;
  ma=a[0];
  for(int i=1;i<N;i++){
    cin >> a[i];
    a[i]=euclidean_gcd(a[i-1],a[i]);
    if(a[i]>ma)ma=a[i];
  }
  if(K%a[N-1]==0 && ma>=K) cout << "POSSIBLE";
  else cout << "IMPOSSIBLE";
}

Submission

Task問題 A - Getting Difference
User nameユーザ名 babumi
Created time投稿日時
Language言語 C++14 (GCC 5.4.1)
Status状態 WA
Score得点 0
Source lengthソースコード長 510 Byte
File nameファイル名
Exec time実行時間 ms
Memory usageメモリ使用量 -

Test case

Set

Set name Score得点 / Max score Cases
Sample - sample_01.txt,sample_02.txt,sample_03.txt,sample_04.txt
All 0 / 300 sample_01.txt,sample_02.txt,sample_03.txt,sample_04.txt,sample_01.txt,sample_02.txt,sample_03.txt,sample_04.txt,subtask_1_01.txt,subtask_1_02.txt,subtask_1_03.txt,subtask_1_04.txt,subtask_1_05.txt,subtask_1_06.txt,subtask_1_07.txt,subtask_1_08.txt,subtask_1_09.txt,subtask_1_10.txt,subtask_1_11.txt

Test case

Case name Status状態 Exec time実行時間 Memory usageメモリ使用量
sample_01.txt AC 1 ms 256 KB
sample_02.txt AC 1 ms 256 KB
sample_03.txt AC 1 ms 256 KB
sample_04.txt AC 1 ms 256 KB
subtask_1_01.txt AC 1 ms 256 KB
subtask_1_02.txt AC 1 ms 256 KB
subtask_1_03.txt WA
subtask_1_04.txt AC 54 ms 640 KB
subtask_1_05.txt AC 29 ms 384 KB
subtask_1_06.txt WA
subtask_1_07.txt AC 33 ms 512 KB
subtask_1_08.txt AC 46 ms 640 KB
subtask_1_09.txt WA
subtask_1_10.txt AC 39 ms 512 KB
subtask_1_11.txt AC 43 ms 512 KB