結果
問題 | No.45 回転寿司 |
ユーザー | yun_app |
提出日時 | 2016-05-09 01:57:39 |
言語 | Java21 (openjdk 21) |
結果 |
AC
|
実行時間 | 424 ms / 5,000 ms |
コード長 | 1,010 bytes |
コンパイル時間 | 2,218 ms |
コンパイル使用メモリ | 75,032 KB |
実行使用メモリ | 61,992 KB |
最終ジャッジ日時 | 2023-08-27 14:52:25 |
合計ジャッジ時間 | 9,014 ms |
ジャッジサーバーID (参考情報) |
judge14 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 86 ms
54,164 KB |
testcase_01 | AC | 193 ms
57,416 KB |
testcase_02 | AC | 313 ms
59,524 KB |
testcase_03 | AC | 424 ms
59,900 KB |
testcase_04 | AC | 264 ms
61,116 KB |
testcase_05 | AC | 52 ms
49,996 KB |
testcase_06 | AC | 122 ms
56,756 KB |
testcase_07 | AC | 313 ms
59,852 KB |
testcase_08 | AC | 91 ms
53,960 KB |
testcase_09 | AC | 280 ms
59,472 KB |
testcase_10 | AC | 116 ms
54,556 KB |
testcase_11 | AC | 89 ms
53,772 KB |
testcase_12 | AC | 235 ms
59,008 KB |
testcase_13 | AC | 54 ms
50,900 KB |
testcase_14 | AC | 46 ms
49,252 KB |
testcase_15 | AC | 120 ms
57,700 KB |
testcase_16 | AC | 90 ms
53,952 KB |
testcase_17 | AC | 103 ms
54,500 KB |
testcase_18 | AC | 107 ms
54,112 KB |
testcase_19 | AC | 386 ms
61,992 KB |
testcase_20 | AC | 45 ms
49,280 KB |
testcase_21 | AC | 51 ms
50,188 KB |
testcase_22 | AC | 45 ms
49,252 KB |
testcase_23 | AC | 46 ms
49,384 KB |
testcase_24 | AC | 43 ms
49,424 KB |
testcase_25 | AC | 44 ms
49,388 KB |
testcase_26 | AC | 122 ms
54,304 KB |
testcase_27 | AC | 318 ms
60,592 KB |
testcase_28 | AC | 122 ms
57,752 KB |
testcase_29 | AC | 284 ms
61,168 KB |
testcase_30 | AC | 300 ms
61,260 KB |
testcase_31 | AC | 44 ms
49,220 KB |
testcase_32 | AC | 44 ms
49,240 KB |
testcase_33 | AC | 408 ms
59,752 KB |
ソースコード
import java.util.*; import java.lang.*; import java.io.*; class Ideone{ public static void main(String[] args) throws Exception{ // your code goes here BufferedReader br = new BufferedReader(new InputStreamReader(System.in)); int N = Integer.parseInt(br.readLine()); String[] prm = br.readLine().split(" "); ArrayList<Integer> dish = new ArrayList<Integer>(); for(String st:prm){ dish.add(Integer.parseInt(st)); } calc(0,0,dish); System.out.println(max); } private static int max = 0; private static HashMap<Integer,Integer> map = new HashMap<Integer,Integer>(); private static void calc(int ans,int idx,ArrayList<Integer> dish){ if(map.containsKey(idx) && map.get(idx) > ans){ return; } map.put(idx,ans); if(idx >= dish.size()){ max = Math.max(ans,max); return; } calc(ans+dish.get(idx),idx+2,dish); calc(ans,idx+1,dish); return; } }