結果
| 問題 | No.332 数列をプレゼントに |
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-03-17 22:15:47 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
WA
|
| 実行時間 | - |
| コード長 | 773 bytes |
| 記録 | |
| コンパイル時間 | 841 ms |
| コンパイル使用メモリ | 117,960 KB |
| 実行使用メモリ | 287,436 KB |
| 最終ジャッジ日時 | 2024-06-12 18:23:39 |
| 合計ジャッジ時間 | 5,305 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 WA * 2 |
| other | AC * 2 MLE * 1 -- * 39 |
ソースコード
import std.stdio, std.array, std.string, std.conv, std.algorithm;
import std.typecons, std.range, std.random, std.math, std.container;
import std.numeric, std.bigint, core.bitop, core.stdc.stdio;
void main() {
auto s = readln.split;
auto N = s[0].to!int;
auto X = s[1].to!long;
auto A = readln.split.map!(to!long).array;
int[][long] dp;
foreach (i; 0..N) {
foreach (k; dp.keys) {
if (A[i]+k <= X && !(A[i]+k in dp))
dp[A[i]+k] = (dp[k] ~ i);
}
if (A[i] <= X && !(A[i] in dp)) dp[A[i]] = [i];
}
string ans = "";
if (X in dp) {
foreach (i; 0..N) {
ans ~= (find(dp[X], i).empty) ? "x" : "o";
}
}
else {
ans = "NO";
}
ans.writeln;
}