結果
問題 |
No.643 Two Operations No.2
|
ユーザー |
|
提出日時 | 2018-04-19 16:53:49 |
言語 | D (dmd 2.109.1) |
結果 |
WA
|
実行時間 | - |
コード長 | 565 bytes |
コンパイル時間 | 848 ms |
コンパイル使用メモリ | 101,936 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-06-13 00:44:28 |
合計ジャッジ時間 | 1,487 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
other | AC * 11 WA * 2 |
ソースコード
import std.algorithm, std.container, std.conv, std.math, std.range, std.typecons, std.stdio, std.string; auto rdsp(){return readln.splitter;} void pick(R,T)(ref R r,ref T t){t=r.front.to!T;r.popFront;} void readV(T...)(ref T t){auto r=rdsp;foreach(ref v;t)pick(r,v);} void main() { int x, y; readV(x, y); if (x != 0 && y != 0 && x.abs != y.abs) { writeln(-1); return; } auto a = [[5, 6, 7], [4, 0, 1], [3, 2, 1]]; auto d = [1, 0, 2, 3, 1, 0, 2, 3]; writeln(d[a[y.sgn+1][x.sgn+1]]); } auto sgn(T)(T n) { return n > 0 ? 1 : n < 0 ? -1 : 0; }