Submission #1306142


Source Code Expand

import java.io.*;
import java.math.*;
import java.util.*;

public class Main {
    private static boolean debug = false;
    private static boolean elapsed = false;

    private static PrintWriter _out = new PrintWriter(System.out);
    private static PrintWriter _err = new PrintWriter(System.err);

    private void solve(Scanner sc) {
        int N = sc.nextInt();
        int odd = 0;
        for (int i = 0; i < N; ++i) {
            int a = sc.nextInt();
            if (a % 2 != 0) {
                ++odd;
            }
        }
        if (odd % 2 == 1) {
            if (N - odd == 0) {
                _out.println("YES");
            } else {
                _out.println("NO");
            }
        } else {
            _out.println("YES");
        }
    }
    private static BigInteger C(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        for (long i = r; i > 1; --i) {
            res = res.divide(BigInteger.valueOf(i));
        }
        return res;
    }
    private static BigInteger P(long n, long r) {
        BigInteger res = BigInteger.ONE;
        for (long i = n; i > n - r; --i) {
            res = res.multiply(BigInteger.valueOf(i));
        }
        return res;
    }
    /*
     * 10^10 > Integer.MAX_VALUE = 2147483647 > 10^9
     * 10^19 > Long.MAX_VALUE = 9223372036854775807L > 10^18
     */
    public static void main(String[] args) {
        long S = System.currentTimeMillis();

        Scanner sc = new Scanner(System.in);
        new Main().solve(sc);
        _out.flush();

        long G = System.currentTimeMillis();
        if (elapsed) {
            _err.println((G - S) + "ms");
        }
        _err.flush();
    }
}

Submission Info

Submission Time
Task A - Addition
User hhelibex
Language Java8 (OpenJDK 1.8.0)
Score 300
Code Size 1855 Byte
Status AC
Exec Time 471 ms
Memory 48536 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 2
AC × 16
Set Name Test Cases
Sample sample1.txt, sample2.txt
All sample1.txt, sample2.txt, in1.txt, in10.txt, in11.txt, in12.txt, in2.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, sample1.txt, sample2.txt
Case Name Status Exec Time Memory
in1.txt AC 458 ms 43936 KB
in10.txt AC 471 ms 46068 KB
in11.txt AC 101 ms 21716 KB
in12.txt AC 99 ms 21076 KB
in2.txt AC 457 ms 48252 KB
in3.txt AC 451 ms 45224 KB
in4.txt AC 457 ms 48020 KB
in5.txt AC 471 ms 48536 KB
in6.txt AC 446 ms 46032 KB
in7.txt AC 448 ms 46440 KB
in8.txt AC 445 ms 44524 KB
in9.txt AC 468 ms 41152 KB
sample1.txt AC 93 ms 19796 KB
sample2.txt AC 91 ms 18640 KB