結果
| 問題 |
No.200 カードファイト!
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2017-05-11 17:29:36 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
RE
|
| 実行時間 | - |
| コード長 | 1,288 bytes |
| コンパイル時間 | 684 ms |
| コンパイル使用メモリ | 121,576 KB |
| 実行使用メモリ | 6,948 KB |
| 最終ジャッジ日時 | 2024-06-12 19:11:22 |
| 合計ジャッジ時間 | 3,076 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 10 WA * 5 RE * 11 |
ソースコード
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;
void main() {
auto N = readln.chomp.to!int;
auto aa = readln.chomp.to!int;
auto AO = readln.split.map!(to!int).array;
AO.sort();
auto A = AO.dup;
auto bb = readln.chomp.to!int;
auto BO = readln.split.map!(to!int).array;
BO.sort();
auto B = BO.dup;
int ans = 0;
foreach (k; 0..N) {
bool played = false;
int pi, pj;
foreach (i; 0..A.length.to!int) {
foreach (j; 0..B.length.to!int) {
if (A[i] > B[j]) {
pi = i;
pj = j;
played = true;
break;
}
}
if (played) break;
}
if (played) {
A = A[0..pi] ~ A[pi+1..$];
B = B[0..pi] ~ B[pi+1..$];
ans += 1;
if (A.length == 0) A = AO.dup;
if (B.length == 0) B = BO.dup;
}
else {
A = A[1..$];
B = B[0..$-1];
if (A.length == 0) A = AO.dup;
if (B.length == 0) B = BO.dup;
}
}
ans.writeln;
}