結果
問題 | No.761 平均値ゲーム |
ユーザー | tenten |
提出日時 | 2023-06-16 13:13:09 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 259 ms / 2,000 ms |
コード長 | 2,452 bytes |
コンパイル時間 | 2,749 ms |
コンパイル使用メモリ | 91,200 KB |
実行使用メモリ | 49,956 KB |
最終ジャッジ日時 | 2024-06-24 07:01:53 |
合計ジャッジ時間 | 20,971 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 52 ms
37,244 KB |
testcase_01 | AC | 52 ms
37,360 KB |
testcase_02 | AC | 52 ms
37,248 KB |
testcase_03 | AC | 53 ms
36,940 KB |
testcase_04 | AC | 52 ms
37,200 KB |
testcase_05 | AC | 52 ms
36,708 KB |
testcase_06 | AC | 51 ms
37,144 KB |
testcase_07 | AC | 53 ms
36,824 KB |
testcase_08 | AC | 52 ms
37,248 KB |
testcase_09 | AC | 51 ms
36,916 KB |
testcase_10 | AC | 53 ms
37,156 KB |
testcase_11 | AC | 53 ms
37,256 KB |
testcase_12 | AC | 53 ms
37,264 KB |
testcase_13 | AC | 53 ms
37,044 KB |
testcase_14 | AC | 53 ms
36,704 KB |
testcase_15 | AC | 54 ms
36,828 KB |
testcase_16 | AC | 53 ms
36,960 KB |
testcase_17 | AC | 53 ms
36,968 KB |
testcase_18 | AC | 53 ms
37,384 KB |
testcase_19 | AC | 52 ms
37,260 KB |
testcase_20 | AC | 52 ms
37,336 KB |
testcase_21 | AC | 52 ms
37,000 KB |
testcase_22 | AC | 52 ms
37,164 KB |
testcase_23 | AC | 53 ms
36,968 KB |
testcase_24 | AC | 52 ms
37,332 KB |
testcase_25 | AC | 53 ms
37,328 KB |
testcase_26 | AC | 54 ms
37,064 KB |
testcase_27 | AC | 53 ms
37,012 KB |
testcase_28 | AC | 52 ms
36,960 KB |
testcase_29 | AC | 52 ms
37,120 KB |
testcase_30 | AC | 53 ms
37,260 KB |
testcase_31 | AC | 53 ms
37,132 KB |
testcase_32 | AC | 52 ms
37,240 KB |
testcase_33 | AC | 200 ms
47,056 KB |
testcase_34 | AC | 230 ms
47,248 KB |
testcase_35 | AC | 114 ms
39,768 KB |
testcase_36 | AC | 184 ms
44,120 KB |
testcase_37 | AC | 187 ms
47,140 KB |
testcase_38 | AC | 219 ms
47,036 KB |
testcase_39 | AC | 210 ms
47,140 KB |
testcase_40 | AC | 238 ms
47,044 KB |
testcase_41 | AC | 226 ms
47,748 KB |
testcase_42 | AC | 226 ms
47,384 KB |
testcase_43 | AC | 139 ms
40,904 KB |
testcase_44 | AC | 180 ms
44,996 KB |
testcase_45 | AC | 210 ms
47,436 KB |
testcase_46 | AC | 181 ms
44,124 KB |
testcase_47 | AC | 176 ms
45,348 KB |
testcase_48 | AC | 101 ms
39,260 KB |
testcase_49 | AC | 216 ms
47,768 KB |
testcase_50 | AC | 128 ms
40,664 KB |
testcase_51 | AC | 110 ms
39,600 KB |
testcase_52 | AC | 111 ms
39,592 KB |
testcase_53 | AC | 230 ms
47,648 KB |
testcase_54 | AC | 176 ms
44,488 KB |
testcase_55 | AC | 232 ms
47,888 KB |
testcase_56 | AC | 162 ms
43,368 KB |
testcase_57 | AC | 218 ms
47,876 KB |
testcase_58 | AC | 127 ms
41,184 KB |
testcase_59 | AC | 214 ms
47,600 KB |
testcase_60 | AC | 156 ms
42,280 KB |
testcase_61 | AC | 223 ms
47,492 KB |
testcase_62 | AC | 225 ms
47,852 KB |
testcase_63 | AC | 130 ms
41,192 KB |
testcase_64 | AC | 220 ms
47,332 KB |
testcase_65 | AC | 186 ms
44,984 KB |
testcase_66 | AC | 111 ms
39,648 KB |
testcase_67 | AC | 164 ms
43,160 KB |
testcase_68 | AC | 116 ms
40,412 KB |
testcase_69 | AC | 199 ms
47,160 KB |
testcase_70 | AC | 188 ms
45,204 KB |
testcase_71 | AC | 152 ms
41,784 KB |
testcase_72 | AC | 120 ms
40,032 KB |
testcase_73 | AC | 153 ms
42,452 KB |
testcase_74 | AC | 146 ms
41,128 KB |
testcase_75 | AC | 179 ms
45,228 KB |
testcase_76 | AC | 146 ms
43,296 KB |
testcase_77 | AC | 204 ms
47,104 KB |
testcase_78 | AC | 207 ms
45,352 KB |
testcase_79 | AC | 135 ms
41,512 KB |
testcase_80 | AC | 136 ms
40,960 KB |
testcase_81 | AC | 127 ms
40,500 KB |
testcase_82 | AC | 188 ms
46,156 KB |
testcase_83 | AC | 237 ms
49,472 KB |
testcase_84 | AC | 236 ms
49,956 KB |
testcase_85 | AC | 235 ms
49,276 KB |
testcase_86 | AC | 259 ms
49,904 KB |
testcase_87 | AC | 250 ms
49,660 KB |
testcase_88 | AC | 248 ms
49,412 KB |
testcase_89 | AC | 243 ms
49,776 KB |
testcase_90 | AC | 240 ms
49,216 KB |
testcase_91 | AC | 240 ms
49,688 KB |
testcase_92 | AC | 247 ms
49,152 KB |
testcase_93 | AC | 53 ms
37,300 KB |
testcase_94 | AC | 53 ms
37,136 KB |
testcase_95 | AC | 246 ms
49,192 KB |
testcase_96 | AC | 252 ms
49,200 KB |
testcase_97 | AC | 248 ms
49,588 KB |
testcase_98 | AC | 185 ms
45,800 KB |
testcase_99 | AC | 235 ms
49,292 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.stream.*; public class Main { static long[] values; static long[] sums; public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); values = new long[n + 1]; sums = new long[n + 1]; for (int i = 1; i <= n; i++) { values[i] = sc.nextLong(); sums[i] = sums[i - 1] + values[i]; } if (getTF(0, n)) { System.out.println("First"); } else { System.out.println("Second"); } } static boolean getTF(int start, int end) { if (end - start == 1) { return true; } if (values[end] * (end - start) == sums[end] - sums[start]) { return true; } double avg = (double)(sums[end] - sums[start]) / (end - start); int left = start; int right = end; while (right - left > 1) { int m = (left + right) / 2; if (values[m] >= avg) { right = m; } else { left = m; } } return !(getTF(start, left) && getTF(left, end)); } } class Utilities { static String arrayToLineString(Object[] arr) { return Arrays.stream(arr).map(x -> x.toString()).collect(Collectors.joining("\n")); } static String arrayToLineString(int[] arr) { return String.join("\n", Arrays.stream(arr).mapToObj(String::valueOf).toArray(String[]::new)); } } class Scanner { BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() throws Exception { } public int nextInt() throws Exception { return Integer.parseInt(next()); } public long nextLong() throws Exception { return Long.parseLong(next()); } public double nextDouble() throws Exception { return Double.parseDouble(next()); } public int[] nextIntArray() throws Exception { return Stream.of(br.readLine().split(" ")).mapToInt(Integer::parseInt).toArray(); } public String next() throws Exception { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } return st.nextToken(); } }