結果
| 問題 | No.332 数列をプレゼントに |
| コンテスト | |
| ユーザー |
kuuso1
|
| 提出日時 | 2015-12-25 23:31:54 |
| 言語 | C#(csc) (csc 3.9.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,553 bytes |
| 記録 | |
| コンパイル時間 | 2,783 ms |
| コンパイル使用メモリ | 114,828 KB |
| 実行使用メモリ | 193,316 KB |
| 最終ジャッジ日時 | 2024-09-19 00:04:50 |
| 合計ジャッジ時間 | 6,733 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 5 |
| other | AC * 1 TLE * 1 -- * 40 |
コンパイルメッセージ
Microsoft (R) Visual C# Compiler version 3.9.0-6.21124.20 (db94f4cc) Copyright (C) Microsoft Corporation. All rights reserved.
ソースコード
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(!nxt.ContainsKey(k))nxt.Add(k,dp[k]);
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));}
}
kuuso1