結果

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

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 2 ms
4,352 KB
testcase_02 WA -
testcase_03 AC 2 ms
4,352 KB
testcase_04 AC 1 ms
4,352 KB
testcase_05 AC 2 ms
4,352 KB
testcase_06 WA -
testcase_07 WA -
testcase_08 AC 1 ms
4,352 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 WA -
testcase_11 AC 2 ms
4,352 KB
testcase_12 AC 1 ms
4,348 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
4,352 KB
testcase_16 AC 2 ms
4,348 KB
testcase_17 AC 2 ms
4,348 KB
testcase_18 WA -
testcase_19 AC 1 ms
4,348 KB
testcase_20 AC 2 ms
4,348 KB
testcase_21 AC 1 ms
4,348 KB
testcase_22 WA -
testcase_23 WA -
testcase_24 AC 2 ms
4,348 KB
testcase_25 AC 2 ms
4,348 KB
testcase_26 AC 1 ms
4,352 KB
testcase_27 WA -
testcase_28 AC 2 ms
4,348 KB
testcase_29 AC 1 ms
4,352 KB
testcase_30 WA -
testcase_31 AC 2 ms
4,348 KB
testcase_32 AC 2 ms
4,348 KB
testcase_33 AC 2 ms
4,348 KB
testcase_34 AC 1 ms
4,348 KB
testcase_35 AC 2 ms
4,352 KB
testcase_36 AC 1 ms
4,352 KB
testcase_37 AC 1 ms
4,348 KB
testcase_38 WA -
testcase_39 AC 1 ms
4,348 KB
testcase_40 AC 2 ms
4,348 KB
testcase_41 AC 1 ms
4,352 KB
testcase_42 AC 2 ms
4,348 KB
testcase_43 AC 2 ms
4,348 KB
testcase_44 AC 1 ms
4,348 KB
testcase_45 AC 1 ms
4,348 KB
testcase_46 AC 2 ms
4,348 KB
testcase_47 AC 2 ms
4,348 KB
testcase_48 AC 1 ms
4,348 KB
testcase_49 WA -
testcase_50 WA -
testcase_51 AC 2 ms
4,348 KB
testcase_52 WA -
testcase_53 AC 2 ms
4,348 KB
testcase_54 AC 2 ms
4,352 KB
testcase_55 AC 1 ms
4,348 KB
testcase_56 AC 1 ms
4,352 KB
testcase_57 AC 2 ms
4,348 KB
testcase_58 AC 2 ms
4,348 KB
testcase_59 AC 1 ms
4,352 KB
testcase_60 AC 2 ms
4,348 KB
testcase_61 AC 1 ms
4,348 KB
testcase_62 AC 2 ms
4,348 KB
testcase_63 AC 1 ms
4,348 KB
testcase_64 AC 1 ms
4,348 KB
testcase_65 AC 2 ms
4,348 KB
testcase_66 AC 2 ms
4,348 KB
testcase_67 AC 2 ms
4,352 KB
testcase_68 AC 2 ms
4,352 KB
testcase_69 AC 2 ms
4,352 KB
testcase_70 AC 2 ms
4,352 KB
testcase_71 AC 2 ms
4,348 KB
testcase_72 AC 2 ms
4,352 KB
testcase_73 AC 1 ms
4,348 KB
testcase_74 AC 1 ms
4,352 KB
testcase_75 AC 2 ms
4,356 KB
testcase_76 AC 1 ms
4,348 KB
testcase_77 AC 1 ms
4,348 KB
testcase_78 AC 1 ms
4,352 KB
testcase_79 AC 1 ms
4,352 KB
testcase_80 WA -
testcase_81 WA -
testcase_82 AC 2 ms
4,348 KB
testcase_83 AC 2 ms
4,352 KB
testcase_84 AC 1 ms
4,352 KB
testcase_85 AC 1 ms
4,348 KB
testcase_86 AC 2 ms
4,348 KB
testcase_87 WA -
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,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 1 ms
4,352 KB
testcase_100 WA -
testcase_101 WA -
testcase_102 WA -
testcase_103 AC 2 ms
4,348 KB
testcase_104 AC 2 ms
4,348 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 2 ms
4,348 KB
testcase_112 AC 2 ms
4,352 KB
testcase_113 WA -
testcase_114 WA -
testcase_115 WA -
testcase_116 WA -
testcase_117 WA -
testcase_118 AC 2 ms
4,352 KB
testcase_119 AC 2 ms
4,348 KB
testcase_120 WA -
testcase_121 AC 1 ms
4,348 KB
testcase_122 AC 2 ms
4,352 KB
testcase_123 WA -
testcase_124 AC 2 ms
4,352 KB
testcase_125 AC 2 ms
4,352 KB
testcase_126 AC 2 ms
4,352 KB
testcase_127 WA -
testcase_128 AC 8 ms
4,348 KB
testcase_129 AC 20 ms
4,348 KB
testcase_130 WA -
testcase_131 WA -
testcase_132 AC 23 ms
4,352 KB
testcase_133 AC 2 ms
4,352 KB
testcase_134 AC 7 ms
4,348 KB
testcase_135 WA -
testcase_136 WA -
testcase_137 AC 13 ms
4,352 KB
testcase_138 WA -
testcase_139 WA -
testcase_140 AC 26 ms
4,620 KB
testcase_141 WA -
testcase_142 WA -
testcase_143 AC 17 ms
4,348 KB
testcase_144 AC 22 ms
4,428 KB
testcase_145 AC 3 ms
4,348 KB
testcase_146 WA -
testcase_147 WA -
testcase_148 AC 10 ms
4,348 KB
testcase_149 AC 16 ms
4,348 KB
testcase_150 AC 22 ms
4,424 KB
testcase_151 AC 3 ms
4,348 KB
testcase_152 AC 18 ms
4,348 KB
testcase_153 AC 26 ms
4,564 KB
testcase_154 AC 2 ms
4,348 KB
testcase_155 AC 20 ms
4,352 KB
testcase_156 WA -
testcase_157 WA -
testcase_158 WA -
testcase_159 WA -
testcase_160 WA -
testcase_161 WA -
testcase_162 AC 23 ms
4,348 KB
testcase_163 AC 13 ms
4,352 KB
testcase_164 AC 27 ms
4,692 KB
testcase_165 AC 20 ms
4,356 KB
testcase_166 AC 5 ms
4,348 KB
testcase_167 AC 14 ms
4,348 KB
testcase_168 AC 10 ms
4,352 KB
testcase_169 AC 11 ms
4,356 KB
testcase_170 AC 9 ms
4,352 KB
testcase_171 AC 15 ms
4,348 KB
testcase_172 AC 11 ms
4,348 KB
testcase_173 AC 3 ms
4,348 KB
testcase_174 AC 23 ms
4,428 KB
testcase_175 AC 27 ms
4,568 KB
testcase_176 AC 19 ms
4,352 KB
testcase_177 AC 4 ms
4,352 KB
testcase_178 AC 19 ms
4,352 KB
testcase_179 AC 21 ms
4,348 KB
testcase_180 AC 24 ms
4,348 KB
testcase_181 AC 7 ms
4,348 KB
testcase_182 AC 11 ms
4,348 KB
testcase_183 AC 15 ms
4,352 KB
testcase_184 AC 12 ms
4,352 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 2 ms
4,352 KB
testcase_189 AC 2 ms
4,352 KB
testcase_190 WA -
testcase_191 WA -
testcase_192 WA -
testcase_193 AC 1 ms
4,352 KB
testcase_194 AC 2 ms
4,348 KB
testcase_195 AC 2 ms
4,352 KB
testcase_196 WA -
testcase_197 WA -
testcase_198 WA -
testcase_199 WA -
testcase_200 AC 22 ms
4,348 KB
testcase_201 AC 12 ms
4,352 KB
testcase_202 WA -
testcase_203 WA -
testcase_204 WA -
testcase_205 WA -
testcase_206 AC 23 ms
4,428 KB
testcase_207 AC 18 ms
4,352 KB
testcase_208 WA -
testcase_209 WA -
testcase_210 WA -
testcase_211 WA -
testcase_212 AC 6 ms
4,348 KB
testcase_213 AC 13 ms
4,348 KB
testcase_214 WA -
testcase_215 WA -
testcase_216 WA -
testcase_217 WA -
testcase_218 AC 25 ms
4,696 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);
	ll mx=2e9,MX=-2e9;
	ll my=2e9,MY=-2e9;
	ll mp=2e9,MP=-2e9;
	ll mm=2e9,MM=-2e9;
	bool o=true;
	for(int i=0;i<N;++i){
		cin>>x[i]>>y[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]);
		o&=(x[i]+y[i])%2==(x[0]+y[0])%2;
	}
	ll z=0;
	if(o){
		for(int _=0;_<4;++_){
			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