結果
問題 | No.325 マンハッタン距離2 |
ユーザー | lip_of_cygnus |
提出日時 | 2016-02-07 09:06:32 |
言語 | C++11 (gcc 11.4.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,248 bytes |
コンパイル時間 | 578 ms |
コンパイル使用メモリ | 68,436 KB |
実行使用メモリ | 4,348 KB |
最終ジャッジ日時 | 2023-10-21 19:35:38 |
合計ジャッジ時間 | 1,756 ms |
ジャッジサーバーID (参考情報) |
judge9 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 1 ms
4,348 KB |
testcase_01 | AC | 2 ms
4,348 KB |
testcase_02 | AC | 1 ms
4,348 KB |
testcase_03 | AC | 2 ms
4,348 KB |
testcase_04 | AC | 2 ms
4,348 KB |
testcase_05 | AC | 2 ms
4,348 KB |
testcase_06 | AC | 2 ms
4,348 KB |
testcase_07 | AC | 2 ms
4,348 KB |
testcase_08 | AC | 2 ms
4,348 KB |
testcase_09 | AC | 2 ms
4,348 KB |
testcase_10 | AC | 2 ms
4,348 KB |
testcase_11 | AC | 2 ms
4,348 KB |
testcase_12 | AC | 2 ms
4,348 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | WA | - |
testcase_19 | WA | - |
testcase_20 | AC | 1 ms
4,348 KB |
testcase_21 | WA | - |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | WA | - |
ソースコード
#include <iostream> #include <algorithm> #include <cstring> #include <string> #include <vector> #include <cmath> #include <sstream> #include <queue> using namespace std; typedef long long ll; typedef vector<int> VI; typedef pair<int,int> pii; #define rep2(x,fr,to) for(int (x)=(fr);(x)<(to);(x)++) #define rep(x,to) for(int (x)=0;(x)<(to);(x)++) #define repr(x,fr,to) for(int (x)=(fr);(x)>=(to);(x)--) #define all(c) (c).begin(),(c).end() #define sz(v) (int)(v).size() #define debug(X) cout<<"["<<#X<<"]"<<X<<endl; #define debug2(X) cout<<X<<endl; #define MAX_N 2010 #define MAX_M 3 const int INF=1e8; typedef pair<int,int>P; //int dx[4]={1,0,-1,0},dy[4]={0,1,0,-1}; // queue<P> que; int a[4],k,L,H,d; #include <deque> int main(){ cin >>a[0]>>a[1]>>a[2]>>a[3]>>d; int minT,maxT; minT=min(abs(a[0]),abs(a[2]))+min(abs(a[1]),abs(a[3])); //maxT=max(abs(a[0]),abs(a[2]))+max(abs(a[1]),abs(a[3]))-minT; k=d-minT; L=min((a[2]-a[0]),(a[3]-a[1])); H=max((a[2]-a[0]),(a[3]-a[1])); if (k<0){cout <<0<<endl;} else if (L+H<k){cout <<(H+1)*(L+1)<<endl;} else if (0<=k && k<L){cout <<(k+1)*(k+2)/2<<endl;} else if (L<=k&& k<=H){cout <<L*(L+1)/2+(L+1)*(k-L+1)<<endl;} else if (H<k && k<=L+H){cout <<(H+1)*(L+1)-(L+H-k)*(L+H-k+1)/2<<endl;} }