結果
問題 | No.5008 [Cherry Alpha] Discrete Pendulum with Air Resistance |
ユーザー | ks2m |
提出日時 | 2022-10-15 00:25:39 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 92 ms / 2,000 ms |
コード長 | 3,870 bytes |
コンパイル時間 | 3,412 ms |
実行使用メモリ | 38,652 KB |
スコア | 947,115,019,560,956 |
最終ジャッジ日時 | 2022-10-15 00:25:55 |
合計ジャッジ時間 | 14,863 ms |
ジャッジサーバーID (参考情報) |
judge10 / judge12 |
純コード判定しない問題か言語 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 73 ms
36,948 KB |
testcase_01 | AC | 84 ms
36,928 KB |
testcase_02 | AC | 75 ms
35,704 KB |
testcase_03 | AC | 72 ms
35,760 KB |
testcase_04 | AC | 71 ms
36,736 KB |
testcase_05 | AC | 72 ms
36,788 KB |
testcase_06 | AC | 71 ms
35,708 KB |
testcase_07 | AC | 70 ms
36,956 KB |
testcase_08 | AC | 85 ms
35,696 KB |
testcase_09 | AC | 73 ms
35,848 KB |
testcase_10 | AC | 68 ms
36,948 KB |
testcase_11 | AC | 72 ms
36,960 KB |
testcase_12 | AC | 72 ms
35,712 KB |
testcase_13 | AC | 67 ms
36,760 KB |
testcase_14 | AC | 86 ms
35,844 KB |
testcase_15 | AC | 75 ms
36,844 KB |
testcase_16 | AC | 70 ms
35,664 KB |
testcase_17 | AC | 72 ms
36,968 KB |
testcase_18 | AC | 71 ms
36,704 KB |
testcase_19 | AC | 80 ms
38,652 KB |
testcase_20 | AC | 92 ms
35,792 KB |
testcase_21 | AC | 69 ms
35,736 KB |
testcase_22 | AC | 69 ms
35,756 KB |
testcase_23 | AC | 73 ms
36,840 KB |
testcase_24 | AC | 71 ms
36,948 KB |
testcase_25 | AC | 71 ms
35,764 KB |
testcase_26 | AC | 73 ms
35,772 KB |
testcase_27 | AC | 79 ms
35,776 KB |
testcase_28 | AC | 71 ms
37,008 KB |
testcase_29 | AC | 72 ms
35,672 KB |
testcase_30 | AC | 71 ms
35,824 KB |
testcase_31 | AC | 71 ms
35,776 KB |
testcase_32 | AC | 70 ms
35,924 KB |
testcase_33 | AC | 82 ms
35,756 KB |
testcase_34 | AC | 68 ms
35,596 KB |
testcase_35 | AC | 68 ms
36,904 KB |
testcase_36 | AC | 69 ms
35,628 KB |
testcase_37 | AC | 71 ms
35,932 KB |
testcase_38 | AC | 73 ms
35,972 KB |
testcase_39 | AC | 82 ms
36,028 KB |
testcase_40 | AC | 70 ms
36,744 KB |
testcase_41 | AC | 68 ms
35,968 KB |
testcase_42 | AC | 69 ms
36,812 KB |
testcase_43 | AC | 71 ms
36,736 KB |
testcase_44 | AC | 73 ms
37,060 KB |
testcase_45 | AC | 71 ms
35,860 KB |
testcase_46 | AC | 81 ms
37,084 KB |
testcase_47 | AC | 74 ms
36,968 KB |
testcase_48 | AC | 70 ms
36,856 KB |
testcase_49 | AC | 71 ms
35,808 KB |
ソースコード
import java.io.BufferedReader; import java.io.InputStreamReader; public class Main { static boolean debug = false; static boolean batch = false; static boolean readFile = false; static int num = 0; static int N, K; static int[] t, u; static double D; public static void main(String[] args) throws Exception { if (batch) { readFile = true; } if (readFile) { if (batch) { long tl = 2000; // TODO long tw = (long) (tl * 0.9); long total = 0; int bidx = 0; long best = 0; int widx = 0; long worst = 1000000000000000000L; int re = 0; int tle = 0; for (int z = 0; z < 100; z++) { try { makeCase(); long st = System.currentTimeMillis(); long score = solve(); long time = System.currentTimeMillis() - st; if (time > tw) { System.out.println(z + ":\t" + score + "\t" + time + "ms"); if (time > tl) { tle++; } } else { System.out.println(z + ":\t" + score); } total += score; if (score > best) { best = score; bidx = z; } if (score < worst) { worst = score; widx = z; } } catch (Exception e) { System.out.println(z + ":\t" + e.getMessage()); re++; } } System.out.println("total: " + total); System.out.println("best: " + bidx + ": " + best); System.out.println("worst: " + widx + ": " + worst); System.out.println("RE: " + re); System.out.println("TLE: " + tle); } else { makeCase(); long score = solve(); System.out.println(score); } } else { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); init(br); solve(); } } static void makeCase() { } static void init(BufferedReader br) throws Exception { String[] sa = br.readLine().split(" "); N = Integer.parseInt(sa[0]); K = Integer.parseInt(sa[1]); sa = br.readLine().split(" "); t = new int[K]; for (int i = 0; i < K; i++) { t[i] = Integer.parseInt(sa[i]); } sa = br.readLine().split(" "); u = new int[K]; for (int i = 0; i < K; i++) { u[i] = Integer.parseInt(sa[i]); } D = 20000000.0 / N / (N - 1); } static long solve() throws Exception { int[] b = new int[N]; int[] m = new int[N]; int[] e = new int[N]; for (int i = 0; i < N; i++) { m[i] = rand(4, 6); b[i] = rand(m[i], m[i] * 2); e[i] = rand(1, 4); } if (!debug) { for (int i = 0; i < N; i++) { System.out.println(b[i] + " " + m[i] + " " + e[i]); } } if (debug) { long score = score(b, m, e); System.out.println(score); return score; } return 0; } static long score(int[] b, int[] m, int[] e) { long sumt = 0; long sumu = 0; for (int i = 0; i < K; i++) { int[] x = new int[N]; for (int j = 0; j < N; j++) { x[j] = getX(b[j], m[j], e[j], t[i]); } int max = 0; double val = 0; for (int j = 0; j < N - 1; j++) { for (int j2 = j + 1; j2 < N; j2++) { val += (double) Math.abs(x[j] - x[j2]) / (b[j] + b[j2]); max = Math.max(max, Math.abs(x[j] - x[j2])); } } sumt += Math.round(val * D); double v1 = max / 20.0 + 1; double v2 = Math.sqrt(v1); sumu += Math.round(10000000 / v2); } long avet = Math.round((double) sumt / K); long aveu = Math.round((double) sumu / K); if (debug) { System.out.println(avet); System.out.println(aveu); } return avet * aveu; } static int getX(int b, int m, int e, int time) { if (time <= b) { return time; } int nx = b; int nt = b; int h = Math.max(b * 2 - e, m * 2); int d = -1; while (true) { if (time <= nt + h) { return nx + (time - nt) * d; } nx += h * d; nt += h; h = Math.max(h - e * 2, m * 2); d = -d; } } static int rand(int l, int r) { int d = r - l; int ret = (int) (Math.random() * d); return ret + l; } }