結果

問題 No.110 しましまピラミッド
ユーザー kuuso1kuuso1
提出日時 2014-12-23 23:47:25
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 27 ms / 5,000 ms
コード長 1,387 bytes
コンパイル時間 986 ms
コンパイル使用メモリ 112,432 KB
実行使用メモリ 26,196 KB
最終ジャッジ日時 2024-12-31 11:01:27
合計ジャッジ時間 2,945 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 4
other AC * 26
権限があれば一括ダウンロードができます
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc)
Copyright (C) Microsoft Corporation. All rights reserved.

ソースコード

diff #

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		Sol mySol =new Sol();
		mySol.Solve();
	}
}

class Sol{
	public void Solve(){
		
		Array.Sort(A[0]);
		Array.Sort(A[1]);
		
		int max=0;
		
		for(int i=0;i<2;i++){
			int[] P=new int[]{0,0};
			int cnt=1;
			P[i]++;
			int turn=1-i;
			int now=A[i][0];
			
			while(true){
				if(P[turn]==A[turn].Length)break;
				if(A[turn][P[turn]]>now){
					now=A[turn][P[turn]];
					P[turn]++;
					cnt++;
					turn=1-turn;
					continue;
				}
				if(P[turn]<A[turn].Length){
					P[turn]++;
					continue;
				}
				break;
			}
			max=Math.Max(cnt,max);
		}
		
		Console.WriteLine(max);
		
		
		
	}
	int N,M;
	int[][] A;
	public Sol(){
		N=ri();
		A=new int[2][];
		A[0]=ria();
		M=ri();
		A[1]=ria();
	}




	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}
0