結果
問題 | No.110 しましまピラミッド |
ユーザー |
![]() |
提出日時 | 2015-06-07 16:32:50 |
言語 | Java (openjdk 23) |
結果 |
AC
|
実行時間 | 155 ms / 5,000 ms |
コード長 | 1,338 bytes |
コンパイル時間 | 4,290 ms |
コンパイル使用メモリ | 78,736 KB |
実行使用メモリ | 54,452 KB |
最終ジャッジ日時 | 2024-12-31 11:10:37 |
合計ジャッジ時間 | 10,161 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge4 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 4 |
other | AC * 26 |
ソースコード
import java.util.*; import java.io.*; import static java.util.Arrays.*; import static java.lang.Math.*; public class No0110 { static final Scanner in = new Scanner(System.in); static final PrintWriter out = new PrintWriter(System.out,false); static void solve() { int nw = in.nextInt(); wb = new int[2][]; wb[0] = new int[nw]; for (int i=0; i<nw; i++) wb[0][i] = in.nextInt(); int nb = in.nextInt(); wb[1] = new int[nb]; for (int i=0; i<nb; i++) wb[1][i] = in.nextInt(); sort(wb[0]); sort(wb[1]); //trace(wb); out.println(count(0) > count(1) ? count(0) : count(1)); } static int[][] wb; static int count(int f) { int[] ptr = new int[2]; int res = 0, max = 0; while (true) { while (ptr[f%2] < wb[f%2].length && wb[f%2][ptr[f%2]] <= max) ptr[f%2]++; if (ptr[f%2] == wb[f%2].length) return res; res++; max = wb[f%2][ptr[f%2]]; f++; } } public static void main(String[] args) { long start = System.currentTimeMillis(); solve(); out.flush(); long end = System.currentTimeMillis(); //trace(end-start + "ms"); in.close(); out.close(); } static void trace(Object... o) { System.out.println(Arrays.deepToString(o));} }