結果
| 問題 |
No.110 しましまピラミッド
|
| コンテスト | |
| ユーザー |
kaiyori_lab
|
| 提出日時 | 2014-12-24 14:52:01 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
CE
(最新)
AC
(最初)
|
| 実行時間 | - |
| コード長 | 670 bytes |
| コンパイル時間 | 306 ms |
| コンパイル使用メモリ | 98,872 KB |
| 最終ジャッジ日時 | 2024-11-14 18:57:40 |
| 合計ジャッジ時間 | 699 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
コンパイルエラー時のメッセージ・ソースコードは、提出者また管理者しか表示できないようにしております。(リジャッジ後のコンパイルエラーは公開されます)
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
ただし、clay言語の場合は開発者のデバッグのため、公開されます。
コンパイルメッセージ
Main.d(24): Error: function `Main.loop(int[] xs, int[] ys, int before = 2147483647, int acc = 0)` is not callable using argument types `(SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted), SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted))` Main.d(24): cannot pass argument `ws` of type `SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted)` to parameter `int[] xs` Main.d(24): Error: function `Main.loop(int[] xs, int[] ys, int before = 2147483647, int acc = 0)` is not callable using argument types `(SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted), SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted))` Main.d(24): cannot pass argument `bs` of type `SortedRange!(int[], "a < b", SortedRangeOptions.assumeSorted)` to parameter `int[] xs`
ソースコード
import std.stdio;
import std.string;
import std.conv;
import std.algorithm;
import std.range;
import std.array;
// つながりの長さを求める(xsから始める) --------------------
int loop(int[] xs, int[] ys, int before=int.max, int acc=0){
if(!xs.length) return acc;
if(xs[$-1] < before) return loop(ys, xs[0..$-1], xs[$-1], acc+1);
return xs.length >= 1 ? loop(xs[0..$-1], ys, before, acc): acc;
}
// main----------------
void main(){
//input
readln;
auto ws = readln.chomp.split(" ").map!(to!int).array.sort;
readln;
auto bs = readln.chomp.split(" ").map!(to!int).array.sort;
//solve
writeln( max(loop(ws, bs), loop(bs, ws)) );
}
kaiyori_lab