結果

問題 No.799 赤黒かーどげぇむ
ユーザー apoanzanapoanzan
提出日時 2019-03-17 21:51:51
言語 C++11
(gcc 13.3.0)
結果
WA  
実行時間 -
コード長 631 bytes
コンパイル時間 2,531 ms
コンパイル使用メモリ 158,816 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-07-07 22:11:51
合計ジャッジ時間 1,901 ms
ジャッジサーバーID
(参考情報)
judge4 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 13 WA * 7
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

typedef long long ll;
typedef pair<int,int> pii;
typedef vector<int> vi;
#define mp make_pair
#define pb push_back
#define pf push_front
#define fi first
#define se second
#define MOD 1000000007

int main(){
	int A,B,C,D;
	int ans = 0;
	cin >> A >> B >> C >> D;
	ans = abs(B-A+1)*abs(D-C+1);
	if(A==C&&B==D){
		cout << 0 <<endl;
		return 0;
	}
	if(B<C){
		ans = (B-A+1)*(D-C+1);
	}else if(C<=B&&B<=D&&A<=C){
		ans -= B-C+1;
	}else if(C<=B&&D<=B){
		ans -= D-C+1;
	}else if(C<=A&&B<=D){
		ans -= B-A+1;
	}else if(C<=A&&D<=B&&D>=A){
		ans -= D-A+1;
	}
	cout << ans << endl;
	return 0;
}
0