# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
745683 | 2023-05-21T01:54:14 Z | rahulverma | Kocka (COCI18_kocka) | Java 11 | 251 ms | 26576 KB |
import java.util.*; import java.io.*; public class kocka { static final int N = 1_00_005, M = 2_010; public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int n = Integer.parseInt(br.readLine()); int ok = 0; int[][] ans = new int[4][N]; HashSet<Integer>[] st = new HashSet[N]; for (int i = 0; i < N; i++) { st[i] = new HashSet<>(); } for (int i = 1; i <= n; i++) { StringTokenizer ts = new StringTokenizer(br.readLine()); int x = Integer.parseInt(ts.nextToken()); if (x == -1) x = n + 1; ans[0][i] = x + 1; st[x + 1].add(i); } for (int i = 1; i <= n; i++) { StringTokenizer ts = new StringTokenizer(br.readLine()); int x = Integer.parseInt(ts.nextToken()); if (x == -1) x = n + 1; if (n - x != -1 && n - x < ans[0][i]) ok = 1; ans[1][i] = n - x; if (n - x == -1) continue; st[n - x].add(i); } for (int i = 1; i <= n; i++) { StringTokenizer ts = new StringTokenizer(br.readLine()); int x = Integer.parseInt(ts.nextToken()); if (x == -1) x = n + 1; if (st[i].size() == 0) continue; if (Collections.min(st[i]) <= x) ok = 1; ans[2][i] = x; } for (int i = 1; i <= n; i++) { StringTokenizer ts = new StringTokenizer(br.readLine()); int x = Integer.parseInt(ts.nextToken()); if (x == -1) x = n + 1; if (st[i].size() == 0) continue; if (Collections.max(st[i]) > n - x) ok = 1; } PrintWriter pw = new PrintWriter(System.out); if (ok == 1) pw.println("NE"); else pw.println("DA"); pw.close(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 163 ms | 19832 KB | Execution failed because the return code was nonzero |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 175 ms | 19500 KB | Execution failed because the return code was nonzero |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 251 ms | 26576 KB | Execution failed because the return code was nonzero |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 202 ms | 26472 KB | Execution failed because the return code was nonzero |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 211 ms | 26272 KB | Execution failed because the return code was nonzero |
2 | Halted | 0 ms | 0 KB | - |