Submission #935177
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() { char[] str = sc.next().toCharArray(); int n = str.length; int g = 0; int p = 0; for (int i = 0; i < n; ++i) { if (str[i] == 'g') { ++g; } else { ++p; } } int v = n / 2 - p; System.out.println(v); } 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 | D - AtCoDeer and Rock-Paper |
User | arukuka |
Language | Java8 (OpenJDK 1.8.0) |
Score | 300 |
Code Size | 1362 Byte |
Status | AC |
Exec Time | 183 ms |
Memory | 13996 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 300 / 300 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_000.txt, 0_001.txt |
All | 0_000.txt, 0_001.txt, 1_002.txt, 1_003.txt, 1_004.txt, 1_005.txt, 1_006.txt, 1_007.txt, 1_008.txt, 1_009.txt, 1_010.txt, 1_011.txt, 1_012.txt, 1_013.txt, 1_014.txt, 1_015.txt, 1_016.txt, 1_017.txt, 1_018.txt, 1_019.txt, 1_020.txt, 1_021.txt, 1_022.txt, 1_023.txt, 1_024.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_000.txt | AC | 122 ms | 9676 KB |
0_001.txt | AC | 122 ms | 9672 KB |
1_002.txt | AC | 173 ms | 13660 KB |
1_003.txt | AC | 160 ms | 10448 KB |
1_004.txt | AC | 183 ms | 13192 KB |
1_005.txt | AC | 159 ms | 10576 KB |
1_006.txt | AC | 180 ms | 13596 KB |
1_007.txt | AC | 143 ms | 9932 KB |
1_008.txt | AC | 178 ms | 13068 KB |
1_009.txt | AC | 176 ms | 12680 KB |
1_010.txt | AC | 178 ms | 13448 KB |
1_011.txt | AC | 168 ms | 12492 KB |
1_012.txt | AC | 178 ms | 13576 KB |
1_013.txt | AC | 147 ms | 9936 KB |
1_014.txt | AC | 174 ms | 12624 KB |
1_015.txt | AC | 172 ms | 12756 KB |
1_016.txt | AC | 173 ms | 12624 KB |
1_017.txt | AC | 171 ms | 13508 KB |
1_018.txt | AC | 176 ms | 13464 KB |
1_019.txt | AC | 139 ms | 9680 KB |
1_020.txt | AC | 179 ms | 13996 KB |
1_021.txt | AC | 175 ms | 12624 KB |
1_022.txt | AC | 170 ms | 12988 KB |
1_023.txt | AC | 173 ms | 12624 KB |
1_024.txt | AC | 171 ms | 13520 KB |