結果
| 問題 |
No.110 しましまピラミッド
|
| コンテスト | |
| ユーザー |
kenji_shioya
|
| 提出日時 | 2016-06-25 21:24:15 |
| 言語 | Java (openjdk 23) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 954 bytes |
| コンパイル時間 | 3,612 ms |
| コンパイル使用メモリ | 77,576 KB |
| 実行使用メモリ | 41,596 KB |
| 最終ジャッジ日時 | 2024-10-11 23:22:30 |
| 合計ジャッジ時間 | 8,902 ms |
|
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 4 |
| other | AC * 12 WA * 14 |
ソースコード
import java.util.*;
public class Exercise127{
public static void main (String[] args){
Scanner sc = new Scanner(System.in);
int n = sc.nextInt();
int[] w = new int[n];
for(int i = 0; i < n; i++){
w[i] = sc.nextInt();
}
Arrays.sort(w);
n = sc.nextInt();
int[] b = new int[n];
for(int i = 0; i < n; i++){
b[i] = sc.nextInt();
}
Arrays.sort(b);
System.out.println(Math.max(build(w, b), build(b, w)));
}
private static int build(int[] first, int[] second){
int top = first[first.length - 1];
int count = 1;
boolean f = true;
for(int i = second.length - 1; i >= 0; i--){
if(second[i] < top && f){
top = second[i];
count++;
f = false;
for(int j = first.length - 1; j >=0; j--){
if(first[j] < top){
top = first[j];
count++;
f = true;
}
}
}
}
return count;
}
}
kenji_shioya