Submission #924421
Source Code Expand
import java.util.ArrayList; import java.util.Arrays; import java.util.Scanner; import java.util.function.BiFunction; public class Main { Scanner sc = new Scanner(System.in); public static void main(String[] args) { new Main().run(); } void run() { int n = ni(); int q = ni(); int[] a = new int[n + 2]; for (int i = 0; i < q; ++i) { int l = ni(); int r = ni() + 1; a[l] = 1 - a[l]; a[r] = 1 - a[r]; } int v = 0; for (int i = 1; i <= n; ++i) { if (a[i] == 1) { v = 1 - v; } System.out.print(v); } System.out.println(); } int ni() { return Integer.parseInt(sc.next()); } void debug(Object... os) { System.err.println(Arrays.deepToString(os)); } class BIT<T> { int n; ArrayList<T> bit; BiFunction<T, T, T> bif; BIT(int n, BiFunction<T, T, T> bif, T defaultValue) { this.n = n; bit = new ArrayList<>(n + 1); for (int i = 0; i < n + 1; ++i) { bit.add(defaultValue); } this.bif = bif; } void update(int i, T v) { for (int x = i; x <= n; x += x & -x) { bit.set(x, bif.apply(bit.get(x), v)); } } T reduce(int i, T defaultValue) { T ret = defaultValue; for (int x = i; x > 0; x -= x & -x) { ret = bif.apply(ret, bit.get(x)); } return ret; } } }
Submission Info
Submission Time | |
---|---|
Task | C - オセロ |
User | arukuka |
Language | Java8 (OpenJDK 1.8.0) |
Score | 100 |
Code Size | 1461 Byte |
Status | AC |
Exec Time | 1634 ms |
Memory | 49788 KB |
Judge Result
Set Name | Sample | Subtask1 | All | ||||||
---|---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 60 / 60 | 40 / 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 | 122 ms | 9676 KB |
00_example_02.txt | AC | 123 ms | 9680 KB |
10_small_01.txt | AC | 170 ms | 12296 KB |
10_small_02.txt | AC | 138 ms | 9936 KB |
10_small_03.txt | AC | 150 ms | 10244 KB |
10_small_04.txt | AC | 163 ms | 11328 KB |
10_small_05.txt | AC | 131 ms | 9680 KB |
10_small_06.txt | AC | 161 ms | 11144 KB |
10_small_07.txt | AC | 151 ms | 10112 KB |
10_small_08.txt | AC | 127 ms | 9552 KB |
10_small_09.txt | AC | 138 ms | 9936 KB |
10_small_10.txt | AC | 133 ms | 9804 KB |
20_rand_01.txt | AC | 783 ms | 32456 KB |
20_rand_02.txt | AC | 462 ms | 31104 KB |
20_rand_03.txt | AC | 836 ms | 24432 KB |
20_rand_04.txt | AC | 682 ms | 31724 KB |
20_rand_05.txt | AC | 381 ms | 29288 KB |
20_rand_06.txt | AC | 785 ms | 31604 KB |
20_rand_07.txt | AC | 806 ms | 25452 KB |
20_rand_08.txt | AC | 348 ms | 16060 KB |
20_rand_09.txt | AC | 419 ms | 29340 KB |
20_rand_10.txt | AC | 491 ms | 28196 KB |
30_max_01.txt | AC | 1517 ms | 49640 KB |
30_max_02.txt | AC | 1616 ms | 49228 KB |
30_max_03.txt | AC | 1542 ms | 49788 KB |
30_max_04.txt | AC | 1626 ms | 49724 KB |
30_max_05.txt | AC | 1634 ms | 49304 KB |
40_corner_01.txt | AC | 529 ms | 45196 KB |
40_corner_02.txt | AC | 1540 ms | 49504 KB |
40_corner_03.txt | AC | 1552 ms | 49360 KB |
40_corner_04.txt | AC | 1577 ms | 49660 KB |
40_corner_05.txt | AC | 1518 ms | 49116 KB |
40_corner_06.txt | AC | 571 ms | 45748 KB |
40_corner_07.txt | AC | 1594 ms | 49396 KB |