Submission #3446081
Source Code Expand
import java.io.*; import java.util.*; class Main { static FastScanner sc = new FastScanner(); static PrintWriter out = new PrintWriter(System.out); public void solve() { int N = sc.nextInt(); int Q = sc.nextInt(); int[] arr = new int[N]; for (int i = 0; i < Q; i++) { int l = sc.nextInt()-1; int r = sc.nextInt()-1; for (int j = l; j <= r; j++) { arr[j]++; } } for (int i = 0; i < N; i++) { if (arr[i] % 2 == 0) { out.print("0"); } else { out.print("1"); } } out.println(); } public static void main(String[] args) { new Main().solve(); out.flush(); } } class FastScanner { private final InputStream in = System.in; private final byte[] buffer = new byte[1024]; private int ptr = 0; private int buflen = 0; private boolean hasNextByte() { if (ptr < buflen) { return true; } else { ptr = 0; try { buflen = in.read(buffer); } catch (IOException e) { e.printStackTrace(); } if (buflen <= 0) { return false; } } return true; } private int readByte() { if (hasNextByte()) return buffer[ptr++]; else return -1; } private static boolean isPrintableChar(int c) { return 33 <= c && c <= 126; } public boolean hasNext() { while (hasNextByte() && !isPrintableChar(buffer[ptr])) ptr++; return hasNextByte(); } public String next() { if (!hasNext()) throw new NoSuchElementException(); StringBuilder sb = new StringBuilder(); int b = readByte(); while (isPrintableChar(b)) { sb.appendCodePoint(b); b = readByte(); } return sb.toString(); } public long nextLong() { if (!hasNext()) throw new NoSuchElementException(); long n = 0; boolean minus = false; int b = readByte(); if (b == '-') { minus = true; b = readByte(); } if (b < '0' || '9' < b) { throw new NumberFormatException(); } while (true) { if ('0' <= b && b <= '9') { n *= 10; n += b - '0'; } else if (b == -1 || !isPrintableChar(b)) { return minus ? -n : n; } else { throw new NumberFormatException(); } b = readByte(); } } public int nextInt() { long nl = nextLong(); if (nl < Integer.MIN_VALUE || nl > Integer.MAX_VALUE) throw new NumberFormatException(); return (int) nl; } public double nextDouble() { return Double.parseDouble(next()); } }
Submission Info
Submission Time | |
---|---|
Task | C - オセロ |
User | r_k |
Language | Java8 (OpenJDK 1.8.0) |
Score | 60 |
Code Size | 2462 Byte |
Status | TLE |
Exec Time | 2109 ms |
Memory | 26260 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 60 / 60 | 0 / 40 | ||||||||
Status |
|
|
|
Set Name | Test Cases |
---|---|
Sample | 00_example_01.txt, 00_example_02.txt |
Subtask1 | 00_example_01.txt, 00_example_02.txt, 10_small_01.txt, 10_small_02.txt, 10_small_03.txt, 10_small_04.txt, 10_small_05.txt, 10_small_06.txt, 10_small_07.txt, 10_small_08.txt, 10_small_09.txt, 10_small_10.txt |
All | 00_example_01.txt, 00_example_02.txt, 10_small_01.txt, 10_small_02.txt, 10_small_03.txt, 10_small_04.txt, 10_small_05.txt, 10_small_06.txt, 10_small_07.txt, 10_small_08.txt, 10_small_09.txt, 10_small_10.txt, 20_rand_01.txt, 20_rand_02.txt, 20_rand_03.txt, 20_rand_04.txt, 20_rand_05.txt, 20_rand_06.txt, 20_rand_07.txt, 20_rand_08.txt, 20_rand_09.txt, 20_rand_10.txt, 30_max_01.txt, 30_max_02.txt, 30_max_03.txt, 30_max_04.txt, 30_max_05.txt, 40_corner_01.txt, 40_corner_02.txt, 40_corner_03.txt, 40_corner_04.txt, 40_corner_05.txt, 40_corner_06.txt, 40_corner_07.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
00_example_01.txt | AC | 70 ms | 20692 KB |
00_example_02.txt | AC | 70 ms | 18644 KB |
10_small_01.txt | AC | 73 ms | 20692 KB |
10_small_02.txt | AC | 71 ms | 20564 KB |
10_small_03.txt | AC | 71 ms | 17876 KB |
10_small_04.txt | AC | 71 ms | 21588 KB |
10_small_05.txt | AC | 83 ms | 20692 KB |
10_small_06.txt | AC | 74 ms | 19156 KB |
10_small_07.txt | AC | 72 ms | 19796 KB |
10_small_08.txt | AC | 70 ms | 19284 KB |
10_small_09.txt | AC | 72 ms | 19284 KB |
10_small_10.txt | AC | 73 ms | 22612 KB |
20_rand_01.txt | AC | 707 ms | 22180 KB |
20_rand_02.txt | AC | 171 ms | 19924 KB |
20_rand_03.txt | AC | 134 ms | 22996 KB |
20_rand_04.txt | AC | 378 ms | 19876 KB |
20_rand_05.txt | AC | 111 ms | 20168 KB |
20_rand_06.txt | AC | 446 ms | 20392 KB |
20_rand_07.txt | AC | 164 ms | 20240 KB |
20_rand_08.txt | AC | 100 ms | 21460 KB |
20_rand_09.txt | AC | 132 ms | 18456 KB |
20_rand_10.txt | AC | 156 ms | 20064 KB |
30_max_01.txt | TLE | 2109 ms | 20132 KB |
30_max_02.txt | TLE | 2109 ms | 21676 KB |
30_max_03.txt | TLE | 2105 ms | 19496 KB |
30_max_04.txt | TLE | 2105 ms | 18596 KB |
30_max_05.txt | TLE | 2105 ms | 21672 KB |
40_corner_01.txt | AC | 111 ms | 20004 KB |
40_corner_02.txt | TLE | 2109 ms | 22048 KB |
40_corner_03.txt | TLE | 2109 ms | 21412 KB |
40_corner_04.txt | AC | 164 ms | 26260 KB |
40_corner_05.txt | AC | 196 ms | 24744 KB |
40_corner_06.txt | AC | 105 ms | 22052 KB |
40_corner_07.txt | TLE | 2108 ms | 20900 KB |