結果

問題 No.332 数列をプレゼントに
ユーザー kuuso1kuuso1
提出日時 2015-12-25 23:38:49
言語 C#(csc)
(csc 3.9.0)
結果
TLE  
実行時間 -
コード長 1,601 bytes
コンパイル時間 992 ms
コンパイル使用メモリ 111,960 KB
実行使用メモリ 145,088 KB
最終ジャッジ日時 2023-10-19 03:51:55
合計ジャッジ時間 5,340 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 34 ms
31,504 KB
testcase_01 AC 33 ms
24,492 KB
testcase_02 AC 33 ms
24,496 KB
testcase_03 AC 32 ms
24,480 KB
testcase_04 AC 34 ms
24,496 KB
testcase_05 AC 33 ms
24,496 KB
testcase_06 AC 326 ms
48,804 KB
testcase_07 TLE -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
権限があれば一括ダウンロードができます
コンパイルメッセージ
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;
using System.Linq;
using System.Text;
using System.Numerics;
using BI=System.Numerics.BigInteger;

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

class Sol{
	public void Solve(){
		
		Dictionary<long,BI> dp=new Dictionary<long,BI>();
		dp.Add(0,0);;
		for(int i=0;i<N;i++){
			Dictionary<long,BI> nxt=new Dictionary<long,BI>();
			foreach(var k in dp.Keys){
				if(k>X)continue;
				if(!nxt.ContainsKey(k))nxt.Add(k,dp[k]);
				if(k+A[i]>X)continue;
				if(!nxt.ContainsKey(k+A[i])){
					nxt.Add(k+A[i],dp[k]|(((BI)1)<<i));
				}
			}
			if(nxt.ContainsKey(X)){
				char[] Ans =new char[N];
				for(int ii=0;ii<N;ii++){
					Ans[ii]='x';
					if(((nxt[X]>>ii)&1)==1)Ans[ii]='o';
				}
				Console.WriteLine(new String(Ans));
				return;
			}
			dp=nxt;
		}
		
		Console.WriteLine("No");
		
		
		
		
		
		
		
		
		
	}
	long[] A;
	int N;
	long X;
	public Sol(){
		var d=rla();
		N=(int)d[0];
		X=d[1];
		A=rla();
	}




	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