結果
| 問題 |
No.2213 Neq Move
|
| コンテスト | |
| ユーザー |
AngrySadEight
|
| 提出日時 | 2022-11-04 17:42:54 |
| 言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
| 結果 |
AC
|
| 実行時間 | 4 ms / 2,000 ms |
| コード長 | 916 bytes |
| コンパイル時間 | 441 ms |
| コンパイル使用メモリ | 66,600 KB |
| 最終ジャッジ日時 | 2025-02-08 17:09:17 |
|
ジャッジサーバーID (参考情報) |
judge2 / judge3 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 1 |
| other | AC * 5 |
ソースコード
#include <iostream>
using namespace std;
typedef long long ll;
int main(){
int T;
cin >> T;
while(T--){
ll A,B,C,D;
cin >> A >> B >> C >> D;
//C < D に統一する
if (C > D){
swap(A, B);
swap(C, D);
}
ll ans = 0;
if (A < B){
if (A <= C && B <= D){
ans = (C - A) + (D - B);
}
else if (A <= C && B > D){
if (A == 1) ans = 3 + C + D;
else ans = 2 + C + D;
}
else if (A > C && B <= D){
ans = 1 + C + (D - B);
}
else{
ans = 2 + C + D;
}
}
else{
if (B <= D){
ans = 1 + (D - B) + C;
}
else{
ans = 2 + C + D;
}
}
cout << ans << endl;
}
}
AngrySadEight