結果

問題 No.949 飲酒プログラミングコンテスト
ユーザー fgwiebfaoishfgwiebfaoish
提出日時 2019-12-12 00:45:50
言語 C#(csc)
(csc 3.9.0)
結果
AC  
実行時間 296 ms / 2,500 ms
コード長 2,994 bytes
コンパイル時間 2,494 ms
コンパイル使用メモリ 105,284 KB
実行使用メモリ 61,264 KB
最終ジャッジ日時 2023-09-06 13:39:04
合計ジャッジ時間 8,456 ms
ジャッジサーバーID
(参考情報)
judge12 / judge11
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 64 ms
20,916 KB
testcase_01 AC 63 ms
22,880 KB
testcase_02 AC 61 ms
18,684 KB
testcase_03 AC 59 ms
20,724 KB
testcase_04 AC 61 ms
20,792 KB
testcase_05 AC 57 ms
20,816 KB
testcase_06 AC 54 ms
18,904 KB
testcase_07 AC 56 ms
20,848 KB
testcase_08 AC 62 ms
23,120 KB
testcase_09 AC 61 ms
19,052 KB
testcase_10 AC 62 ms
21,004 KB
testcase_11 AC 206 ms
55,424 KB
testcase_12 AC 221 ms
55,712 KB
testcase_13 AC 214 ms
53,592 KB
testcase_14 AC 79 ms
23,076 KB
testcase_15 AC 157 ms
50,136 KB
testcase_16 AC 254 ms
59,412 KB
testcase_17 AC 88 ms
32,320 KB
testcase_18 AC 282 ms
58,068 KB
testcase_19 AC 179 ms
53,432 KB
testcase_20 AC 89 ms
29,568 KB
testcase_21 AC 70 ms
25,080 KB
testcase_22 AC 82 ms
30,148 KB
testcase_23 AC 68 ms
21,084 KB
testcase_24 AC 194 ms
48,860 KB
testcase_25 AC 257 ms
59,092 KB
testcase_26 AC 293 ms
61,000 KB
testcase_27 AC 263 ms
60,988 KB
testcase_28 AC 296 ms
60,948 KB
testcase_29 AC 213 ms
58,916 KB
testcase_30 AC 158 ms
60,936 KB
testcase_31 AC 130 ms
61,264 KB
testcase_32 AC 278 ms
61,028 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
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.Generic;
using System.Collections;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using System.IO;
using System.Reflection;
using static System.Math;
using System.Numerics;
static class Program{
	const int mod=(int)1e9+7;
	static void Main(){
		Sc sc=new Sc();
		var n=sc.I;
		var a=sc.Ia3(false,0,true,int.MinValue/3);
		var b=sc.Ia3(false,0,true,int.MinValue/3);
		var d=sc.Ia;
		Array.Sort(d);
		int ans=0;
		var dp=new int[n+1][];
		dp[0]=new int[]{n,n};
		for(int i = 1;i<=n;i++) {
			dp[i]=new int[n+1];
			for(int j = 0;j<=i;j++) {
				int p=a[j]+b[i-j];
				int c=Max(dp[i-1][j],dp[i-1][j>0?j-1:j]);
				if(c<=0){continue;}
				dp[i][j]=d.Bs(p+1,true,c-1);
				if(dp[i][j]!=-1){ans=i;}
			}
		}
		Console.WriteLine("{0}",ans);
	}
}
static class Ex1{
	public static int Bs(this int[] a,int x,bool b){return Bs2(a,x,b,a.Length);}
	public static int Bs(this int[] a,int x,bool b,int ub){return Bs2(a,x,b,ub+1);}
	private static int Bs2(int[] a,int x,bool b,int ub){
		int lb=-1,mid=0;
		while(ub-lb>1){
			mid=(ub+lb)/2;
			if(a[mid]>=x){ub=mid;}
			else{lb=mid;}
		}
		return b?lb:ub;
	}
}

public class Sc{
	public int I{get{return int.Parse(Console.ReadLine());}}
	public long L{get{return long.Parse(Console.ReadLine());}}
	public double D{get{return double.Parse(Console.ReadLine());}}
	public string S{get{return Console.ReadLine();}}
	public int[] Ia{get{return Array.ConvertAll(Console.ReadLine().Split(),int.Parse);}}
	public long[] La{get{return Array.ConvertAll(Console.ReadLine().Split(),long.Parse);}}
	public double[] Da{get{return Array.ConvertAll(Console.ReadLine().Split(),double.Parse);}}
	public string[] Sa{get{return Console.ReadLine().Split();}}
	public object[] Oa{get{return Console.ReadLine().Split();}}
	public int[] Ia2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),int.Parse);}}
	public int[] Ia3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),int.Parse);}
	public int[] Ia3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),int.Parse);}
	public long[] La2{get{return Array.ConvertAll(("0 "+Console.ReadLine()+" 0").Split(),long.Parse);}}
	public long[] La3(int a){return Array.ConvertAll((a.ToString()+" "+Console.ReadLine()).Split(),long.Parse);}
	public long[] La3(bool a,int b,bool c,int d){return Array.ConvertAll(((a?b.ToString()+" ":"")+Console.ReadLine()+(c?" "+d.ToString():"")).Split(),long.Parse);}
	public T[] Arr<T>(int n,Func<T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f();}return a;}
	public T[] Arr<T>(int n,Func<int,T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i);}return a;}
	public T[] Arr<T>(int n,Func<string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(Console.ReadLine().Split());}return a;}
	public T[] Arr<T>(int n,Func<int,string[],T> f){var a=new T[n];for(int i=0;i<n;i++){a[i]=f(i,Console.ReadLine().Split());}return a;}
}
0