Submission #1572998
Source Code Expand
#include <bits/stdc++.h> #define PB push_back #define PF push_front #define MP make_pair #define FI first #define SE second #define SIZE( A ) int( ( A ).size( ) ) #define ALL( A ) ( A ).begin( ), ( A ).end( ) #define ALLR( A ) ( A ).rbegin( ), ( A ).rend( ) using namespace std; typedef long long ll; typedef unsigned long long ull; typedef long double lf; typedef pair< int, int > pii; typedef pair< ll, ll > pll; typedef vector< bool > vb; typedef vector< lf > vd; typedef vector< ll > vll; typedef vector< int > vi; typedef vector< pii > vpii; const int MAXN = int( 1e5 )+10; const int MOD = int( 360 ); const int oo = INT_MAX; int n, odd, even, cnt; int arr[ MAXN ]; bool reduce() { if( odd != 1 ) return false; int gcd = 0; for( int i = 0; i < n; ++i ) { if( arr[i] == 1 ) return false; if( arr[i]%2 ) --arr[i]; gcd = __gcd( gcd, arr[i] ); } odd = even = 0; for( int i = 0; i < n; ++i ) { arr[i] /= gcd; if( arr[i]%2 ) ++odd; else ++even; } return true; } int main( ) { #ifdef LOCAL freopen( "input", "r", stdin ); //freopen( "output", "w", stdout ); #else //freopen( "input", "r", stdin ); //freopen( "output", "w", stdout ); ios_base::sync_with_stdio( 0 ); cin.tie( 0 ); #endif while( cin >> n ) { even = odd = cnt = 0; for( int i = 0; i < n; ++i ) { cin >> arr[ i ]; if( arr[i]%2 ) ++odd; else ++even; } while( reduce() ){ ++cnt; } even += cnt; if( even%2 ) { cout << "First\n"; } else { cout << "Second\n"; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Decrementing |
User | vjudge1 |
Language | C++14 (GCC 5.4.1) |
Score | 1000 |
Code Size | 1696 Byte |
Status | AC |
Exec Time | 39 ms |
Memory | 640 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 1000 / 1000 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in2.txt, in20.txt, in21.txt, in22.txt, in23.txt, in24.txt, in25.txt, in26.txt, in27.txt, in28.txt, in29.txt, in3.txt, in30.txt, in31.txt, in32.txt, in33.txt, in34.txt, in35.txt, in36.txt, in37.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt, sample3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 11 ms | 640 KB |
in10.txt | AC | 11 ms | 640 KB |
in11.txt | AC | 20 ms | 640 KB |
in12.txt | AC | 11 ms | 640 KB |
in13.txt | AC | 18 ms | 640 KB |
in14.txt | AC | 34 ms | 640 KB |
in15.txt | AC | 16 ms | 640 KB |
in16.txt | AC | 33 ms | 640 KB |
in17.txt | AC | 15 ms | 640 KB |
in18.txt | AC | 39 ms | 640 KB |
in19.txt | AC | 19 ms | 640 KB |
in2.txt | AC | 11 ms | 640 KB |
in20.txt | AC | 35 ms | 640 KB |
in21.txt | AC | 21 ms | 640 KB |
in22.txt | AC | 19 ms | 640 KB |
in23.txt | AC | 19 ms | 640 KB |
in24.txt | AC | 21 ms | 640 KB |
in25.txt | AC | 19 ms | 640 KB |
in26.txt | AC | 19 ms | 640 KB |
in27.txt | AC | 20 ms | 640 KB |
in28.txt | AC | 21 ms | 640 KB |
in29.txt | AC | 19 ms | 640 KB |
in3.txt | AC | 11 ms | 640 KB |
in30.txt | AC | 18 ms | 640 KB |
in31.txt | AC | 11 ms | 640 KB |
in32.txt | AC | 11 ms | 640 KB |
in33.txt | AC | 21 ms | 640 KB |
in34.txt | AC | 23 ms | 640 KB |
in35.txt | AC | 21 ms | 640 KB |
in36.txt | AC | 1 ms | 256 KB |
in37.txt | AC | 1 ms | 256 KB |
in4.txt | AC | 11 ms | 640 KB |
in5.txt | AC | 11 ms | 640 KB |
in6.txt | AC | 11 ms | 640 KB |
in7.txt | AC | 12 ms | 640 KB |
in8.txt | AC | 12 ms | 640 KB |
in9.txt | AC | 11 ms | 640 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |