Submission #1093180


Source Code Expand

Copy
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.IO;
using System.Text;
using System.Globalization;
using System.Diagnostics;

class Myon
{
    static Scanner cin;
    public Myon() { }
    public static int Main()
    {
        cin = new Scanner();
        new Myon().calc();
        return 0;
    }


    int N;
    public bool calc2(long[] A)
    {
        long sum = 0;
        for (int i = 0; i < N; i++)
        {
            sum += A[i];
        }
        if ((sum - N) % 2 == 1) return true;
        if (N % 2 == 0) return false;

        int oddcnt = 0;
        int oddpos = -1;
        for (int i = 0; i < N; i++)
        {
            if(A[i] % 2 == 1)
            {
                oddpos = i;
                oddcnt++;
            }
        }

        if (oddcnt != 1) return false;
        if (A[oddpos] == 1) return false;
        A[oddpos]--;

        while (true)
        {
            bool flag = true;
            for (int i = 0; i < N; i++)
            {
                if (A[i] % 2 != 0) flag = false;
            }
            if (!flag) break;
            for (int i = 0; i < N; i++)
            {
                A[i] /= 2;
            }
        }

        return !calc2(A);
    }

    public void calc()
    {
        long[] A;
        N = cin.nextInt();
        A = new long[N];
        for (int i = 0; i < N; i++)
        {
            A[i] = cin.nextLong();
        }
        if (calc2(A)) Console.WriteLine("First");
        else Console.WriteLine("Second");
    }
    
}

class Scanner
{
    string[] s;
    int i;

    char[] cs = new char[] { ' ' };

    public Scanner()
    {
        s = new string[0];
        i = 0;
    }

    public string next()
    {
        while (i >= s.Length)
        {
            string st = Console.ReadLine();
            while (st == "") st = Console.ReadLine();
            s = st.Split(cs, StringSplitOptions.RemoveEmptyEntries);
            i = 0;
        }
        return s[i++];
    }

    public int nextInt()
    {
        return int.Parse(next());
    }

    public long nextLong()
    {
        return long.Parse(next());
    }

    public double nextDouble()
    {
        return double.Parse(next());
    }

}

Submission Info

Submission Time
Task D - Decrementing
User chokudai
Language C# (Mono 4.6.2.0)
Score 0
Code Size 2362 Byte
Status WA
Exec Time 123 ms
Memory 16472 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 1000
Status
AC × 3
AC × 33
WA × 7
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
Case Name Status Exec Time Memory
in1.txt AC 77 ms 16344 KB
in10.txt AC 76 ms 16344 KB
in11.txt AC 91 ms 16344 KB
in12.txt AC 75 ms 16344 KB
in13.txt AC 86 ms 16344 KB
in14.txt AC 115 ms 16344 KB
in15.txt AC 84 ms 16344 KB
in16.txt AC 114 ms 16344 KB
in17.txt AC 83 ms 16344 KB
in18.txt AC 123 ms 16344 KB
in19.txt AC 85 ms 14936 KB
in2.txt AC 75 ms 16344 KB
in20.txt AC 114 ms 15320 KB
in21.txt WA 86 ms 16472 KB
in22.txt AC 78 ms 16472 KB
in23.txt AC 86 ms 16472 KB
in24.txt WA 88 ms 16472 KB
in25.txt WA 77 ms 16088 KB
in26.txt AC 100 ms 16472 KB
in27.txt AC 76 ms 16088 KB
in28.txt WA 84 ms 16472 KB
in29.txt AC 78 ms 16088 KB
in3.txt AC 75 ms 16344 KB
in30.txt AC 82 ms 16472 KB
in31.txt AC 76 ms 16344 KB
in32.txt AC 76 ms 16344 KB
in33.txt WA 78 ms 16216 KB
in34.txt WA 96 ms 16472 KB
in35.txt WA 100 ms 16344 KB
in36.txt AC 19 ms 2648 KB
in37.txt AC 19 ms 2648 KB
in4.txt AC 76 ms 16344 KB
in5.txt AC 75 ms 16344 KB
in6.txt AC 76 ms 16344 KB
in7.txt AC 75 ms 16344 KB
in8.txt AC 75 ms 16344 KB
in9.txt AC 75 ms 16344 KB
sample1.txt AC 19 ms 2648 KB
sample2.txt AC 19 ms 2648 KB
sample3.txt AC 20 ms 2648 KB