結果
問題 | No.602 隠されていたゲーム2 |
ユーザー |
![]() |
提出日時 | 2017-12-02 00:26:04 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 679 bytes |
コンパイル時間 | 701 ms |
コンパイル使用メモリ | 108,808 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-12 22:45:24 |
合計ジャッジ時間 | 1,710 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 WA * 7 |
ソースコード
void main(){import std.stdio, std.string, std.conv, std.algorithm;import std.math, std.range;int n; rd(n);auto d=readln.split.to!(int[]);int x, y; rd(x, y);if(x==0 && y==0){writeln(0); return;}auto d0=x.abs+y.abs;if(count(d, d0)){writeln(1); return;}sort(d);auto p=assumeSorted(d);foreach(i; 0..n){if(p.canFind(d0-d[i])){writeln(2); return;}if(p.canFind(d0+d[i])){writeln(2); return;}if(p.canFind(d[i]-d0)){writeln(2); return;}}writeln(-1);}void rd(T...)(ref T x){import std.stdio, std.string, std.conv;auto l=readln.split;assert(l.length==x.length);foreach(i, ref e; x){e=l[i].to!(typeof(e));}}