結果

問題 No.960 マンハッタン距離3
ユーザー 👑 kmjpkmjp
提出日時 2019-12-23 00:48:41
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 1,333 bytes
コンパイル時間 2,801 ms
コンパイル使用メモリ 165,856 KB
実行使用メモリ 5,192 KB
最終ジャッジ日時 2023-10-12 23:31:03
合計ジャッジ時間 10,304 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 RE -
testcase_01 RE -
testcase_02 RE -
testcase_03 AC 1 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 1 ms
4,348 KB
testcase_06 AC 2 ms
4,352 KB
testcase_07 AC 1 ms
4,352 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,352 KB
testcase_10 AC 2 ms
4,352 KB
testcase_11 AC 1 ms
4,352 KB
testcase_12 AC 2 ms
4,352 KB
testcase_13 AC 2 ms
4,356 KB
testcase_14 AC 2 ms
4,352 KB
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 1 ms
4,352 KB
testcase_17 AC 1 ms
4,348 KB
testcase_18 AC 1 ms
4,480 KB
testcase_19 AC 1 ms
4,356 KB
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 1 ms
4,348 KB
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 1 ms
4,348 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 AC 1 ms
4,352 KB
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 1 ms
4,352 KB
testcase_36 WA -
testcase_37 WA -
testcase_38 WA -
testcase_39 WA -
testcase_40 AC 2 ms
4,348 KB
testcase_41 AC 1 ms
4,348 KB
testcase_42 AC 2 ms
4,348 KB
testcase_43 AC 1 ms
4,348 KB
testcase_44 AC 1 ms
4,348 KB
testcase_45 AC 2 ms
4,352 KB
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 WA -
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 WA -
testcase_54 AC 2 ms
4,348 KB
testcase_55 AC 1 ms
4,348 KB
testcase_56 AC 2 ms
4,348 KB
testcase_57 AC 2 ms
4,352 KB
testcase_58 AC 2 ms
4,352 KB
testcase_59 AC 2 ms
4,352 KB
testcase_60 WA -
testcase_61 WA -
testcase_62 WA -
testcase_63 WA -
testcase_64 AC 1 ms
4,348 KB
testcase_65 AC 1 ms
4,352 KB
testcase_66 AC 2 ms
4,352 KB
testcase_67 AC 1 ms
4,352 KB
testcase_68 AC 1 ms
4,476 KB
testcase_69 AC 2 ms
4,352 KB
testcase_70 AC 1 ms
4,352 KB
testcase_71 AC 1 ms
4,348 KB
testcase_72 AC 2 ms
4,352 KB
testcase_73 AC 2 ms
4,352 KB
testcase_74 AC 2 ms
4,348 KB
testcase_75 AC 1 ms
4,348 KB
testcase_76 AC 2 ms
4,356 KB
testcase_77 AC 2 ms
4,352 KB
testcase_78 AC 2 ms
4,352 KB
testcase_79 AC 1 ms
4,352 KB
testcase_80 AC 2 ms
4,352 KB
testcase_81 AC 2 ms
4,348 KB
testcase_82 AC 2 ms
4,348 KB
testcase_83 AC 1 ms
4,352 KB
testcase_84 AC 2 ms
4,348 KB
testcase_85 AC 2 ms
4,356 KB
testcase_86 AC 2 ms
4,352 KB
testcase_87 AC 1 ms
4,352 KB
testcase_88 WA -
testcase_89 WA -
testcase_90 WA -
testcase_91 WA -
testcase_92 AC 1 ms
4,348 KB
testcase_93 AC 1 ms
4,480 KB
testcase_94 WA -
testcase_95 WA -
testcase_96 WA -
testcase_97 WA -
testcase_98 AC 1 ms
4,356 KB
testcase_99 AC 2 ms
4,348 KB
testcase_100 WA -
testcase_101 WA -
testcase_102 WA -
testcase_103 AC 2 ms
4,352 KB
testcase_104 AC 2 ms
4,352 KB
testcase_105 AC 2 ms
4,348 KB
testcase_106 WA -
testcase_107 WA -
testcase_108 WA -
testcase_109 WA -
testcase_110 AC 2 ms
4,356 KB
testcase_111 AC 1 ms
4,348 KB
testcase_112 AC 1 ms
4,352 KB
testcase_113 AC 1 ms
4,356 KB
testcase_114 AC 1 ms
4,348 KB
testcase_115 AC 2 ms
4,352 KB
testcase_116 AC 2 ms
4,348 KB
testcase_117 AC 2 ms
4,348 KB
testcase_118 AC 1 ms
4,352 KB
testcase_119 AC 2 ms
4,352 KB
testcase_120 AC 2 ms
4,352 KB
testcase_121 AC 1 ms
4,348 KB
testcase_122 AC 2 ms
4,348 KB
testcase_123 AC 2 ms
4,348 KB
testcase_124 AC 1 ms
4,352 KB
testcase_125 AC 2 ms
4,348 KB
testcase_126 AC 2 ms
4,356 KB
testcase_127 AC 1 ms
4,352 KB
testcase_128 WA -
testcase_129 WA -
testcase_130 WA -
testcase_131 WA -
testcase_132 WA -
testcase_133 WA -
testcase_134 AC 8 ms
4,352 KB
testcase_135 WA -
testcase_136 WA -
testcase_137 AC 13 ms
4,348 KB
testcase_138 WA -
testcase_139 WA -
testcase_140 AC 25 ms
4,972 KB
testcase_141 WA -
testcase_142 WA -
testcase_143 AC 16 ms
4,352 KB
testcase_144 WA -
testcase_145 WA -
testcase_146 WA -
testcase_147 WA -
testcase_148 AC 10 ms
4,348 KB
testcase_149 AC 15 ms
4,468 KB
testcase_150 AC 21 ms
4,828 KB
testcase_151 AC 2 ms
4,352 KB
testcase_152 AC 18 ms
4,688 KB
testcase_153 AC 26 ms
5,156 KB
testcase_154 WA -
testcase_155 WA -
testcase_156 WA -
testcase_157 WA -
testcase_158 WA -
testcase_159 WA -
testcase_160 WA -
testcase_161 WA -
testcase_162 AC 23 ms
4,752 KB
testcase_163 AC 13 ms
4,348 KB
testcase_164 AC 24 ms
4,904 KB
testcase_165 AC 19 ms
4,492 KB
testcase_166 AC 5 ms
4,352 KB
testcase_167 AC 12 ms
4,352 KB
testcase_168 WA -
testcase_169 WA -
testcase_170 WA -
testcase_171 WA -
testcase_172 AC 10 ms
4,352 KB
testcase_173 AC 3 ms
4,352 KB
testcase_174 AC 21 ms
4,884 KB
testcase_175 AC 25 ms
5,116 KB
testcase_176 AC 18 ms
4,712 KB
testcase_177 AC 4 ms
4,348 KB
testcase_178 AC 19 ms
4,768 KB
testcase_179 AC 20 ms
4,608 KB
testcase_180 AC 23 ms
4,968 KB
testcase_181 AC 6 ms
4,352 KB
testcase_182 AC 11 ms
4,348 KB
testcase_183 AC 15 ms
4,360 KB
testcase_184 AC 11 ms
4,356 KB
testcase_185 AC 17 ms
4,468 KB
testcase_186 AC 21 ms
4,676 KB
testcase_187 AC 16 ms
4,352 KB
testcase_188 AC 2 ms
4,352 KB
testcase_189 AC 1 ms
4,352 KB
testcase_190 AC 1 ms
4,352 KB
testcase_191 AC 2 ms
4,540 KB
testcase_192 AC 2 ms
4,348 KB
testcase_193 AC 1 ms
4,352 KB
testcase_194 AC 2 ms
4,352 KB
testcase_195 AC 2 ms
4,348 KB
testcase_196 WA -
testcase_197 WA -
testcase_198 WA -
testcase_199 WA -
testcase_200 AC 21 ms
4,764 KB
testcase_201 AC 13 ms
4,352 KB
testcase_202 WA -
testcase_203 WA -
testcase_204 WA -
testcase_205 WA -
testcase_206 AC 23 ms
4,860 KB
testcase_207 AC 18 ms
4,472 KB
testcase_208 WA -
testcase_209 WA -
testcase_210 WA -
testcase_211 WA -
testcase_212 AC 6 ms
4,352 KB
testcase_213 AC 13 ms
4,348 KB
testcase_214 WA -
testcase_215 WA -
testcase_216 WA -
testcase_217 WA -
testcase_218 AC 24 ms
5,064 KB
testcase_219 AC 14 ms
4,352 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#define _P(...) (void)printf(__VA_ARGS__)
#define FOR(x,to) for(x=0;x<(to);x++)
#define FORR(x,arr) for(auto& x:arr)
#define ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

ll H,W;
int N;
ll X[101010],Y[101010];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>W>>H;
	cin>>N;
	int C[2]={};
	FOR(i,N) {
		cin>>X[i]>>Y[i];
		X[i]--;
		Y[i]--;
		C[(X[i]+Y[i])%2]++;
	}
	
	if(C[0]>0 && C[0]<N) return _P("0\n");
	
	if(N==2) {
		if(X[0]>X[1]) swap(X[0],X[1]),swap(Y[0],Y[1]);
		if(abs(X[0]-X[1])<abs(Y[0]-Y[1])) cout<<W<<endl;
		else if(abs(X[0]-X[1])>abs(Y[0]-Y[1])) cout<<H<<endl;
		else {
			ll ret=0;
			if(Y[0]<Y[1]) ret+=(Y[0]+1)*(W-X[1])+(H-Y[1])*(X[0]+1)+(X[1]-X[0]-1);
			else ret+=(Y[1]+1)*(X[0]+1)+(H-Y[0])*(W-X[1])+(X[1]-X[0]-1);
			cout<<ret<<endl;
		}
	}
	else if(N>=5) {
		cout<<0<<endl;
	}
	else {
		assert(0);
	}
	
}


int main(int argc,char** argv){
	string s;int i;
	if(argc==1) ios::sync_with_stdio(false), cin.tie(0);
	FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin);
	cout.tie(0); solve(); return 0;
}
0