Submission #4292977


Source Code Expand

Copy
#include <bits/stdc++.h>

using namespace std;

int gcd(int a, int b) {
  if(a < b) swap(a, b);
  if(b == 0) return a;
  return gcd(b, a%b);
}

int main() {
  int N;
  int A[100001];
  cin >> N;
  for(int i=0; i<N; ++i) {
    cin >> A[i];
  }
  int ans = gcd(A[0], A[1]);
  for(int i=2; i<N; ++i) {
      ans = gcd(ans, A[i]);
  }
  cout << ans << endl;
}

Submission Info

Submission Time
Task C - Monsters Battle Royale
User kivantium
Language C++14 (GCC 5.4.1)
Score 300
Code Size 377 Byte
Status
Exec Time 55 ms
Memory 640 KB

Test Cases

Set Name Score / Max Score Test Cases
All 300 / 300 0_random_1, 0_random_2, 0_random_3, 0_random_4, 1_normal_1, 1_normal_2, 1_normal_3, 1_normal_4, 1_normal_5, 1_normal_6, 2_corner_1, 2_corner_2, 2_corner_3, 2_corner_4, 2_corner_5, 2_corner_6, 2_corner_7, 2_corner_8, sample_01, sample_02, sample_03
Sample 0 / 0 sample_01, sample_02, sample_03
Case Name Status Exec Time Memory
0_random_1 33 ms 512 KB
0_random_2 54 ms 640 KB
0_random_3 1 ms 256 KB
0_random_4 1 ms 256 KB
1_normal_1 12 ms 384 KB
1_normal_2 37 ms 512 KB
1_normal_3 55 ms 640 KB
1_normal_4 53 ms 640 KB
1_normal_5 1 ms 256 KB
1_normal_6 1 ms 256 KB
2_corner_1 50 ms 640 KB
2_corner_2 54 ms 640 KB
2_corner_3 1 ms 256 KB
2_corner_4 55 ms 640 KB
2_corner_5 54 ms 640 KB
2_corner_6 12 ms 384 KB
2_corner_7 13 ms 384 KB
2_corner_8 19 ms 384 KB
sample_01 1 ms 256 KB
sample_02 1 ms 256 KB
sample_03 1 ms 256 KB