結果
問題 | No.2961 Shiny Monster Master |
ユーザー | tenten |
提出日時 | 2024-11-18 14:49:46 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 266 ms / 1,777 ms |
コード長 | 1,662 bytes |
コンパイル時間 | 2,591 ms |
コンパイル使用メモリ | 87,860 KB |
実行使用メモリ | 62,028 KB |
最終ジャッジ日時 | 2024-11-18 14:50:09 |
合計ジャッジ時間 | 20,163 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 104 ms
51,872 KB |
testcase_01 | AC | 128 ms
53,220 KB |
testcase_02 | AC | 115 ms
53,208 KB |
testcase_03 | AC | 125 ms
53,240 KB |
testcase_04 | AC | 84 ms
52,148 KB |
testcase_05 | AC | 212 ms
58,732 KB |
testcase_06 | AC | 188 ms
59,112 KB |
testcase_07 | AC | 219 ms
58,616 KB |
testcase_08 | AC | 243 ms
61,208 KB |
testcase_09 | AC | 119 ms
52,604 KB |
testcase_10 | AC | 261 ms
60,636 KB |
testcase_11 | AC | 235 ms
59,216 KB |
testcase_12 | AC | 201 ms
59,112 KB |
testcase_13 | AC | 107 ms
52,732 KB |
testcase_14 | AC | 246 ms
60,056 KB |
testcase_15 | AC | 241 ms
59,832 KB |
testcase_16 | AC | 169 ms
59,044 KB |
testcase_17 | AC | 249 ms
56,564 KB |
testcase_18 | AC | 258 ms
58,620 KB |
testcase_19 | AC | 246 ms
58,412 KB |
testcase_20 | AC | 242 ms
61,400 KB |
testcase_21 | AC | 256 ms
58,636 KB |
testcase_22 | AC | 173 ms
56,560 KB |
testcase_23 | AC | 222 ms
58,296 KB |
testcase_24 | AC | 205 ms
56,920 KB |
testcase_25 | AC | 236 ms
58,716 KB |
testcase_26 | AC | 252 ms
59,668 KB |
testcase_27 | AC | 248 ms
58,120 KB |
testcase_28 | AC | 196 ms
58,384 KB |
testcase_29 | AC | 179 ms
59,468 KB |
testcase_30 | AC | 220 ms
60,348 KB |
testcase_31 | AC | 219 ms
58,964 KB |
testcase_32 | AC | 238 ms
59,964 KB |
testcase_33 | AC | 240 ms
62,028 KB |
testcase_34 | AC | 209 ms
59,064 KB |
testcase_35 | AC | 248 ms
59,560 KB |
testcase_36 | AC | 181 ms
58,464 KB |
testcase_37 | AC | 237 ms
58,344 KB |
testcase_38 | AC | 208 ms
59,612 KB |
testcase_39 | AC | 218 ms
58,988 KB |
testcase_40 | AC | 214 ms
58,848 KB |
testcase_41 | AC | 154 ms
54,944 KB |
testcase_42 | AC | 256 ms
59,016 KB |
testcase_43 | AC | 169 ms
57,192 KB |
testcase_44 | AC | 264 ms
59,560 KB |
testcase_45 | AC | 67 ms
50,840 KB |
testcase_46 | AC | 198 ms
56,456 KB |
testcase_47 | AC | 211 ms
60,408 KB |
testcase_48 | AC | 161 ms
57,480 KB |
testcase_49 | AC | 189 ms
57,008 KB |
testcase_50 | AC | 266 ms
58,892 KB |
testcase_51 | AC | 228 ms
57,208 KB |
testcase_52 | AC | 207 ms
58,496 KB |
testcase_53 | AC | 191 ms
58,724 KB |
testcase_54 | AC | 169 ms
56,836 KB |
testcase_55 | AC | 239 ms
60,088 KB |
testcase_56 | AC | 248 ms
58,416 KB |
testcase_57 | AC | 199 ms
56,384 KB |
testcase_58 | AC | 190 ms
58,572 KB |
testcase_59 | AC | 243 ms
58,700 KB |
testcase_60 | AC | 231 ms
57,868 KB |
testcase_61 | AC | 208 ms
56,712 KB |
testcase_62 | AC | 239 ms
61,328 KB |
testcase_63 | AC | 228 ms
61,140 KB |
testcase_64 | AC | 202 ms
56,800 KB |
testcase_65 | AC | 243 ms
59,420 KB |
testcase_66 | AC | 100 ms
51,972 KB |
testcase_67 | AC | 125 ms
53,016 KB |
testcase_68 | AC | 96 ms
52,156 KB |
testcase_69 | AC | 132 ms
53,152 KB |
testcase_70 | AC | 116 ms
53,236 KB |
testcase_71 | AC | 102 ms
51,844 KB |
testcase_72 | AC | 126 ms
53,028 KB |
testcase_73 | AC | 129 ms
53,212 KB |
testcase_74 | AC | 243 ms
61,720 KB |
testcase_75 | AC | 250 ms
61,500 KB |
testcase_76 | AC | 257 ms
61,924 KB |
ソースコード
import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int r = sc.nextInt(); int n = sc.nextInt(); int[] counts = new int[r]; for (int i = 0; i < n; i++) { counts[sc.nextInt()]++; } for (int i = 1; i < r; i++) { counts[i] += counts[i - 1]; } String result = IntStream.range(0, sc.nextInt()).mapToObj(i -> { int left = sc.nextInt() - 1; int right = sc.nextInt(); int ans = right / r * n + counts[right % r] - left / r * n - counts[left % r]; return String.valueOf(ans); }).collect(Collectors.joining("\n")); System.out.println(result); } } class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }