結果

問題 No.960 マンハッタン距離3
ユーザー %20%20
提出日時 2019-12-19 20:01:59
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,363 bytes
コンパイル時間 2,006 ms
コンパイル使用メモリ 201,360 KB
実行使用メモリ 4,696 KB
最終ジャッジ日時 2023-10-11 14:33:38
合計ジャッジ時間 10,326 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

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

ソースコード

diff #

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

using ll=long long;

int main(){cin.tie(0);ios::sync_with_stdio(false);
	ll W,H;cin>>W>>H;
	int N;cin>>N;
	vector<ll>x(N),y(N);
	bool o=true;
	for(int i=0;i<N;++i){
		cin>>x[i]>>y[i];
		o&=(x[i]+y[i])%2==(x[0]+y[0])%2;
	}
	ll z=0;
	if(o){
		for(int _=0;_<4;++_){
			ll mx=2e9,MX=-2e9;
			ll my=2e9,MY=-2e9;
			ll mp=2e9,MP=-2e9;
			ll mm=2e9,MM=-2e9;
			for(int i=0;i<N;++i){
				mx=min(mx,x[i]);
				MX=max(MX,x[i]);
				my=min(my,y[i]);
				MY=max(MY,y[i]);
				mp=min(mp,x[i]+y[i]);
				MP=max(MP,x[i]+y[i]);
				mm=min(mm,x[i]-y[i]);
				MM=max(MM,x[i]-y[i]);
			}
			if(N==2){
				if(mp==MP){
					z=max(z,mx*my+(W-MX+1)*(H-MY+1)+MX-mx-1);
				}else if(MX-mx<MY-my){
					z=max(z,W);
				}
			}else{
				bool a=mp==MP;
				bool b=true;
				bool c=MP-mp>=MM-mm;
				bool d=c;
				bool e=MP-mp==MM-mm;
				for(int i=0;i<N;++i){
					b&=x[i]+y[i]==MP||x[i]-y[i]==MM;
					c&=x[i]+y[i]==MP||x[i]+y[i]==mp;
					d&=x[i]+y[i]==MP||x[i]+y[i]==mp||x[i]-y[i]==MM;
					e&=x[i]+y[i]==MP||x[i]+y[i]==mp||x[i]-y[i]==MM||x[i]-y[i]==mm;
				}
				if(a)z=max(z,mx*my+(W-MX+1)*(H-MY+1));
				if(b)z=max(z,mx);
				if(c)z=max(z,((MP-mp)-(MM-mm))/2+1);
				if(d)z=max(z,1ll);
				if(e)z=max(z,1ll);
			}
			for(int i=0;i<N;++i){
				ll t=x[i];
				x[i]=H-y[i]+1;
				y[i]=t;
			}
			swap(W,H);
		}
	}
	cout<<z<<"\n";
	return 0;
}
0