# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
745681 | 2023-05-21T01:51:48 Z | rahulverma | Kocka (COCI18_kocka) | Java 11 | 1000 ms | 51788 KB |
import java.util.*; public class kocka { static final long mod = 100000000000031L; static final int N = 1_00_005, M = 2_010; public static long summ(long x, long y) { return ((x % mod) + (y % mod)) % mod; } public static long mult(long x, long y) { return ((x % mod) * (y % mod)) % mod; } public static void main(String[] args) { Scanner scanner = new Scanner(System.in); int n = scanner.nextInt(); 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++) { int x = scanner.nextInt(); if (x == -1) x = n + 1; ans[0][i] = x + 1; st[x + 1].add(i); } for (int i = 1; i <= n; i++) { int x = scanner.nextInt(); 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++) { int x = scanner.nextInt(); 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++) { int x = scanner.nextInt(); if (x == -1) x = n + 1; if (st[i].size() == 0) continue; if (Collections.max(st[i]) > n - x) ok = 1; } if (ok == 1) System.out.println("NE"); else System.out.println("DA"); scanner.close(); } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 385 ms | 25784 KB | Output is correct |
2 | Correct | 343 ms | 24924 KB | Output is correct |
3 | Correct | 392 ms | 25096 KB | Output is correct |
4 | Correct | 326 ms | 24884 KB | Output is correct |
5 | Correct | 376 ms | 24912 KB | Output is correct |
6 | Correct | 347 ms | 24944 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 373 ms | 25080 KB | Output is correct |
2 | Correct | 342 ms | 23308 KB | Output is correct |
3 | Correct | 371 ms | 25028 KB | Output is correct |
4 | Correct | 327 ms | 23424 KB | Output is correct |
5 | Correct | 398 ms | 25236 KB | Output is correct |
6 | Correct | 346 ms | 24972 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1071 ms | 49876 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1071 ms | 51788 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Execution timed out | 1052 ms | 49088 KB | Time limit exceeded |
2 | Halted | 0 ms | 0 KB | - |