Submission #1593291
Source Code Expand
#include<bits/stdc++.h> using namespace std; #define MAXN 100000+10 int n,a[MAXN]; int gcd(int a,int b){return b==0?a:gcd(b,a%b);} bool f(){ long long sum=0; bool flag=0; int num=0; for(int i=1;i<=n;i++){ sum+=a[i]-1; if(a[i]&1)num++; if(a[i]==1)flag=1; } if(flag)return sum%2; if((n-num)%2)return 1; if(num==1){ int g=0; for(int i=1;i<=n;i++) if(a[i]&1)a[i]--; for(int i=1;i<=n;i++)g=gcd(g,a[i]); for(int i=1;i<=n;i++)a[i]/=g; return f()^1; } return 0; } int main(){ scanf("%d",&n); for(int i=1;i<=n;i++)scanf("%d",&a[i]); if(f())printf("First"); else printf("Second"); }
Submission Info
Submission Time | |
---|---|
Task | D - Decrementing |
User | vjudge5 |
Language | Bash (GNU bash v4.3.11) |
Score | 0 |
Code Size | 705 Byte |
Status | RE |
Exec Time | 5 ms |
Memory | 684 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 | RE | 5 ms | 684 KB |
in10.txt | RE | 3 ms | 568 KB |
in11.txt | RE | 3 ms | 576 KB |
in12.txt | RE | 3 ms | 572 KB |
in13.txt | RE | 3 ms | 572 KB |
in14.txt | RE | 3 ms | 568 KB |
in15.txt | RE | 3 ms | 568 KB |
in16.txt | RE | 3 ms | 572 KB |
in17.txt | RE | 3 ms | 568 KB |
in18.txt | RE | 3 ms | 568 KB |
in19.txt | RE | 2 ms | 568 KB |
in2.txt | RE | 3 ms | 572 KB |
in20.txt | RE | 3 ms | 568 KB |
in21.txt | RE | 3 ms | 568 KB |
in22.txt | RE | 3 ms | 572 KB |
in23.txt | RE | 3 ms | 572 KB |
in24.txt | RE | 3 ms | 572 KB |
in25.txt | RE | 3 ms | 572 KB |
in26.txt | RE | 3 ms | 572 KB |
in27.txt | RE | 2 ms | 572 KB |
in28.txt | RE | 3 ms | 576 KB |
in29.txt | RE | 2 ms | 568 KB |
in3.txt | RE | 3 ms | 568 KB |
in30.txt | RE | 3 ms | 572 KB |
in31.txt | RE | 2 ms | 572 KB |
in32.txt | RE | 3 ms | 572 KB |
in33.txt | RE | 3 ms | 572 KB |
in34.txt | RE | 3 ms | 572 KB |
in35.txt | RE | 3 ms | 572 KB |
in36.txt | RE | 3 ms | 568 KB |
in37.txt | RE | 3 ms | 572 KB |
in4.txt | RE | 3 ms | 572 KB |
in5.txt | RE | 3 ms | 568 KB |
in6.txt | RE | 3 ms | 572 KB |
in7.txt | RE | 3 ms | 564 KB |
in8.txt | RE | 3 ms | 572 KB |
in9.txt | RE | 3 ms | 572 KB |
sample1.txt | RE | 3 ms | 568 KB |
sample2.txt | RE | 3 ms | 572 KB |
sample3.txt | RE | 3 ms | 568 KB |