結果
| 問題 |
No.2213 Neq Move
|
| ユーザー |
|
| 提出日時 | 2023-02-10 22:19:15 |
| 言語 | D (dmd 2.109.1) |
| 結果 |
AC
|
| 実行時間 | 3 ms / 2,000 ms |
| コード長 | 893 bytes |
| コンパイル時間 | 681 ms |
| コンパイル使用メモリ | 100,460 KB |
| 実行使用メモリ | 6,944 KB |
| 最終ジャッジ日時 | 2024-06-22 17:29:55 |
| 合計ジャッジ時間 | 1,189 ms |
|
ジャッジサーバーID (参考情報) |
judge1 / judge2 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
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));
}
}
}
}
}