結果
| 問題 |
No.110 しましまピラミッド
|
| コンテスト | |
| ユーザー |
kohaku_kohaku
|
| 提出日時 | 2016-12-03 06:25:48 |
| 言語 | Java (openjdk 23) |
| 結果 |
AC
|
| 実行時間 | 157 ms / 5,000 ms |
| コード長 | 948 bytes |
| コンパイル時間 | 2,611 ms |
| コンパイル使用メモリ | 77,680 KB |
| 実行使用メモリ | 54,392 KB |
| 最終ジャッジ日時 | 2024-12-31 11:26:25 |
| 合計ジャッジ時間 | 8,279 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 26 |
ソースコード
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();
}
Arrays.sort(W);
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;
}
}
}
kohaku_kohaku