Submission #371140
Source Code Expand
import java.io.IOException; import java.util.Arrays; import java.util.InputMismatchException; public class Main { boolean check(String s1, String s2, String s3) { String not = "not"; if (s1.equals(not) && s2.equals(not) && !s3.equals(not)) { return true; } return false; } void run() { MyScanner sc = new MyScanner(); String[] s = sc.nextLine().split(" "); boolean[] use = new boolean[s.length]; Arrays.fill(use, true); for (int i = 0; i < s.length - 2; i++) { if (!use[i]) { continue; } if (check(s[i], s[i + 1], s[i + 2])) { use[i] = false; use[i + 1] = false; } } String tab = ""; for (int i = 0; i < s.length; i++) { if (use[i]) { System.out.print(tab + s[i]); tab = " "; } } System.out.println(); } public static void main(String[] args) { new Main().run(); } public void mapDebug(int[][] a) { System.out.println("--------map display---------"); for (int i = 0; i < a.length; i++) { for (int j = 0; j < a[i].length; j++) { System.out.printf("%3d ", a[i][j]); } System.out.println(); } System.out.println("----------------------------" + '\n'); } class MyScanner { int read() { try { return System.in.read(); } catch (IOException e) { throw new InputMismatchException(); } } boolean isSpaceChar(int c) { return c == ' ' || c == '\n' || c == '\r' || c == '\t' || c == -1; } boolean isEndline(int c) { return c == '\n' || c == '\r' || c == -1; } int nextInt() { return Integer.parseInt(next()); } int[] nextIntArray(int n) { int[] array = new int[n]; for (int i = 0; i < n; i++) array[i] = nextInt(); return array; } long nextLong() { return Long.parseLong(next()); } long[] nextLongArray(int n) { long[] array = new long[n]; for (int i = 0; i < n; i++) array[i] = nextLong(); return array; } double nextDouble() { return Double.parseDouble(next()); } double[] nextDoubleArray(int n) { double[] array = new double[n]; for (int i = 0; i < n; i++) array[i] = nextDouble(); return array; } String next() { int c = read(); while (isSpaceChar(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isSpaceChar(c)); return res.toString(); } String[] nextStringArray(int n) { String[] array = new String[n]; for (int i = 0; i < n; i++) array[i] = next(); return array; } String nextLine() { int c = read(); while (isEndline(c)) c = read(); StringBuilder res = new StringBuilder(); do { res.appendCodePoint(c); c = read(); } while (!isEndline(c)); return res.toString(); } } }
Submission Info
Submission Time | |
---|---|
Task | A - 二重否定除去法則 |
User | fujisu |
Language | Java8 (OpenJDK 1.8.0) |
Score | 0 |
Code Size | 2876 Byte |
Status | WA |
Exec Time | 509 ms |
Memory | 28412 KB |
Judge Result
Set Name | All | ||||
---|---|---|---|---|---|
Score / Max Score | 0 / 100 | ||||
Status |
|
Set Name | Test Cases |
---|---|
All | scrambled_00.txt, scrambled_01.txt, scrambled_02.txt, scrambled_03.txt, scrambled_04.txt, scrambled_05.txt, scrambled_06.txt, scrambled_07.txt, scrambled_08.txt, scrambled_09.txt, scrambled_10.txt, scrambled_11.txt, scrambled_12.txt, scrambled_13.txt, scrambled_14.txt, scrambled_15.txt, scrambled_16.txt, scrambled_17.txt, scrambled_18.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
scrambled_00.txt | AC | 462 ms | 27320 KB |
scrambled_01.txt | AC | 467 ms | 27260 KB |
scrambled_02.txt | AC | 464 ms | 27288 KB |
scrambled_03.txt | AC | 466 ms | 27232 KB |
scrambled_04.txt | AC | 472 ms | 27216 KB |
scrambled_05.txt | WA | 505 ms | 28304 KB |
scrambled_06.txt | AC | 500 ms | 28412 KB |
scrambled_07.txt | WA | 509 ms | 28244 KB |
scrambled_08.txt | WA | 506 ms | 28304 KB |
scrambled_09.txt | AC | 485 ms | 27852 KB |
scrambled_10.txt | AC | 477 ms | 27956 KB |
scrambled_11.txt | AC | 480 ms | 28144 KB |
scrambled_12.txt | AC | 489 ms | 28056 KB |
scrambled_13.txt | AC | 486 ms | 28156 KB |
scrambled_14.txt | AC | 494 ms | 28156 KB |
scrambled_15.txt | AC | 491 ms | 28152 KB |
scrambled_16.txt | AC | 486 ms | 28200 KB |
scrambled_17.txt | AC | 487 ms | 28024 KB |
scrambled_18.txt | AC | 490 ms | 28068 KB |