Submission #1134309
Source Code Expand
#include <algorithm> #include <cstdio> #include <functional> #include <iostream> #include <cfloat> #include <climits> #include <cstdlib> #include <cstring> #include <cmath> #include <map> #include <unordered_map> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <time.h> #include <vector> using namespace std; typedef long long ll; typedef unsigned long long ull; typedef pair<int, int> pii; typedef pair<long long, long long> pll; typedef pair<double, long long> pdl; const long double pi = 3.141592653589793; #define debug(x) cerr << #x << " = " << (x) << endl; #define rep(i, n) for(int i = 0;i < n;i++) #define pb push_back #define mp make_pair #define mod 1000000007 ll gcd(ll x, ll y) { if(y == 0) return x; else return gcd(y, x % y); } int main() { //freopen("input07.txt","r",stdin); //freopen("output_file_name.txt","w",stdout); int n;cin>>n; ll even = 0, odd = 0; ll A[n]; rep(i, n) {cin>>A[i];if(A[i]%2==0) even++;else odd++;} if(n == 1) { cout<<"Second"<<endl; return 0; } if(even%2 != 0) { cout<<"First"<<endl; return 0; } if(odd >= 2) { cout<<"Second"<<endl; return 0; } int f = 1; while(true) { rep(i, n) {if(A[i]%2 != 0) {A[i]-=1;break;}} ll cgcd = 0; rep(i, n) cgcd = gcd(cgcd, A[i]); even = odd = 0; rep(i, n) {A[i]/=cgcd;if(A[i]%2==0) even++;else odd++;} f = 1^f; if(even%2 != 0) { if(f) cout<<"First"<<endl; else cout<<"Second"<<endl; return 0; } if(odd >= 2) { if(f) cout<<"Second"<<endl; else cout<<"First"<<endl; return 0; } } return 0; }
Submission Info
Submission Time | |
---|---|
Task | D - Decrementing |
User | cryptomanic |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1964 Byte |
Status | WA |
Exec Time | 111 ms |
Memory | 1024 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 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 | 40 ms | 1024 KB |
in10.txt | AC | 40 ms | 1024 KB |
in11.txt | AC | 62 ms | 1024 KB |
in12.txt | AC | 40 ms | 1024 KB |
in13.txt | AC | 56 ms | 1024 KB |
in14.txt | AC | 99 ms | 1024 KB |
in15.txt | AC | 53 ms | 1024 KB |
in16.txt | AC | 95 ms | 1024 KB |
in17.txt | AC | 50 ms | 1024 KB |
in18.txt | AC | 111 ms | 1024 KB |
in19.txt | AC | 58 ms | 896 KB |
in2.txt | AC | 40 ms | 1024 KB |
in20.txt | AC | 99 ms | 896 KB |
in21.txt | AC | 66 ms | 1024 KB |
in22.txt | AC | 63 ms | 1024 KB |
in23.txt | AC | 61 ms | 1024 KB |
in24.txt | AC | 67 ms | 1024 KB |
in25.txt | AC | 59 ms | 1024 KB |
in26.txt | AC | 62 ms | 1024 KB |
in27.txt | AC | 62 ms | 1024 KB |
in28.txt | AC | 67 ms | 1024 KB |
in29.txt | AC | 59 ms | 1024 KB |
in3.txt | AC | 40 ms | 1024 KB |
in30.txt | AC | 60 ms | 1024 KB |
in31.txt | AC | 41 ms | 1024 KB |
in32.txt | AC | 40 ms | 1024 KB |
in33.txt | WA | 67 ms | 1024 KB |
in34.txt | WA | 75 ms | 1024 KB |
in35.txt | WA | 68 ms | 1024 KB |
in36.txt | AC | 1 ms | 256 KB |
in37.txt | AC | 1 ms | 256 KB |
in4.txt | AC | 40 ms | 1024 KB |
in5.txt | AC | 40 ms | 1024 KB |
in6.txt | AC | 40 ms | 1024 KB |
in7.txt | AC | 40 ms | 1024 KB |
in8.txt | AC | 40 ms | 1024 KB |
in9.txt | AC | 40 ms | 1024 KB |
sample1.txt | AC | 1 ms | 256 KB |
sample2.txt | AC | 1 ms | 256 KB |
sample3.txt | AC | 1 ms | 256 KB |