結果
問題 |
No.110 しましまピラミッド
|
ユーザー |
![]() |
提出日時 | 2016-12-03 06:24:45 |
言語 | Java (openjdk 23) |
結果 |
WA
|
実行時間 | - |
コード長 | 924 bytes |
コンパイル時間 | 2,413 ms |
コンパイル使用メモリ | 77,848 KB |
実行使用メモリ | 56,104 KB |
最終ジャッジ日時 | 2024-11-27 17:52:52 |
合計ジャッジ時間 | 6,319 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 WA * 1 |
other | AC * 7 WA * 19 |
ソースコード
import java.util.*; public class Main { public static void main(String[] args) { Scanner sc = new Scanner(System.in); int Nw = sc.nextInt(); int [] W = new int [Nw]; for(int i=0; i<Nw; i++){ W[i] = sc.nextInt(); } int Nb = sc.nextInt(); int [] B = new int [Nb]; for(int i=0; i<Nb; i++){ B[i] = sc.nextInt(); } Arrays.sort(B); int rw=arrange(W,B,W[0]); int rb=arrange(B,W,B[0]); int ans=Math.max(rw,rb); System.out.println(ans); } static int arrange(int []a, int []b, int c){ if(c>=b[b.length-1]){ return 1; }else{ for(int i=0; i<b.length; i++){ if(c<b[i]){ c=b[i]; break; } } int x=1+arrange(b,a,c); return x; } } }