Submission #3221846
Source Code Expand
import java.io.OutputStream; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; import java.io.PrintWriter; import java.io.BufferedWriter; import java.io.Writer; import java.io.OutputStreamWriter; import java.util.InputMismatchException; import java.io.IOException; import java.io.InputStream; /** * Built using CHelper plug-in * Actual solution is at the top * * @author prakharjain */ public class Main { public static void main(String[] args) { InputStream inputStream = System.in; OutputStream outputStream = System.out; InputReader in = new InputReader(inputStream); OutputWriter out = new OutputWriter(outputStream); agc014b solver = new agc014b(); solver.solve(1, in, out); out.close(); } static class agc014b { public void solve(int testNumber, InputReader in, OutputWriter out) { int n = in.nextInt(); int m = in.nextInt(); int[] c = new int[n]; for (int i = 0; i < m; i++) { int a = in.nextInt() - 1; int b = in.nextInt() - 1; c[a]++; c[b]++; } for (int i = 0; i < n; i++) { if (c[i] % 2 != 0) { out.println("NO"); return; } } out.println("YES"); } } static class OutputWriter { private final PrintWriter writer; public OutputWriter(OutputStream outputStream) { writer = new PrintWriter(new BufferedWriter(new OutputStreamWriter(outputStream))); } public OutputWriter(Writer writer) { this.writer = new PrintWriter(writer); } public void print(Object... objects) { for (int i = 0; i < objects.length; i++) { if (i != 0) { writer.print(' '); } writer.print(objects[i]); } } public void println(Object... objects) { print(objects); writer.println(); } public void close() { writer.close(); } } static class InputReader { private InputStream stream; private byte[] buf = new byte[1024]; private int curChar; private int numChars; private InputReader.SpaceCharFilter filter; public InputReader(InputStream stream) { this.stream = stream; } public static boolean isWhitespace(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } public int read() { if (numChars == -1) { throw new InputMismatchException(); } if (curChar >= numChars) { curChar = 0; try { numChars = stream.read(buf); } catch (IOException e) { throw new InputMismatchException(); } if (numChars <= 0) { return -1; } } return buf[curChar++]; } public int nextInt() { int c = read(); while (isSpaceChar(c)) { c = read(); } int sgn = 1; if (c == '-') { sgn = -1; c = read(); } int res = 0; do { if (c < '0' || c > '9') { throw new InputMismatchException(); } res *= 10; res += c - '0'; c = read(); } while (!isSpaceChar(c)); return res * sgn; } public boolean isSpaceChar(int c) { if (filter != null) { return filter.isSpaceChar(c); } return isWhitespace(c); } public interface SpaceCharFilter { public boolean isSpaceChar(int ch); } } }
Submission Info
Submission Time | |
---|---|
Task | B - Unplanned Queries |
User | leashptntl |
Language | Java8 (OpenJDK 1.8.0) |
Score | 500 |
Code Size | 4254 Byte |
Status | AC |
Exec Time | 106 ms |
Memory | 23252 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 500 / 500 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt |
All | sample1.txt, sample2.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.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 | 95 ms | 20948 KB |
in10.txt | AC | 105 ms | 19924 KB |
in11.txt | AC | 105 ms | 21204 KB |
in12.txt | AC | 105 ms | 21972 KB |
in13.txt | AC | 102 ms | 18772 KB |
in14.txt | AC | 91 ms | 18516 KB |
in15.txt | AC | 69 ms | 19668 KB |
in16.txt | AC | 69 ms | 17876 KB |
in2.txt | AC | 93 ms | 20436 KB |
in3.txt | AC | 95 ms | 23252 KB |
in4.txt | AC | 93 ms | 19668 KB |
in5.txt | AC | 92 ms | 19924 KB |
in6.txt | AC | 104 ms | 18900 KB |
in7.txt | AC | 105 ms | 21076 KB |
in8.txt | AC | 103 ms | 19796 KB |
in9.txt | AC | 106 ms | 21460 KB |
sample1.txt | AC | 70 ms | 22740 KB |
sample2.txt | AC | 70 ms | 21332 KB |