結果
問題 | No.2213 Neq Move |
ユーザー | lanegue |
提出日時 | 2023-02-10 22:19:15 |
言語 | D (dmd 2.106.1) |
結果 |
AC
|
実行時間 | 3 ms / 2,000 ms |
コード長 | 893 bytes |
コンパイル時間 | 605 ms |
コンパイル使用メモリ | 89,208 KB |
実行使用メモリ | 4,384 KB |
最終ジャッジ日時 | 2023-09-04 19:50:27 |
合計ジャッジ時間 | 1,175 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge11 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,376 KB |
testcase_01 | AC | 2 ms
4,380 KB |
testcase_02 | AC | 3 ms
4,376 KB |
testcase_03 | AC | 3 ms
4,376 KB |
testcase_04 | AC | 3 ms
4,384 KB |
testcase_05 | AC | 3 ms
4,384 KB |
ソースコード
import std.stdio; import std.string; import std.conv; import std.math; void main(){ auto T = readln.chomp.to!int; for(auto t = 0; t < T; t++){ auto s = readln.chomp.split.to!(int[]); int a,b,c,d; if(s[0] < s[1]){ a = s[0]; b = s[1]; c = s[2]; d = s[3]; }else{ a = s[1]; b = s[0]; c = s[3]; d = s[2]; } if(b <= d){ if(c < d){ if(a <= c){ writeln((d - b) + (c - a)); }else{ writeln((d - b) + (1 + c)); } }else{ writeln((c - a) + (1 + d)); } }else{ if(c < d){ if(a == 1){ writeln((1 + d) + (1 + c) + 1); }else{ writeln((1 + d) + (1 + c)); } }else{ if(a <= c){ writeln((1 + d) + (c - a)); }else{ writeln((1 + d) + (1 + c)); } } } } }