結果
問題 | No.960 マンハッタン距離3 |
ユーザー | chocorusk |
提出日時 | 2019-12-23 01:03:54 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 2,997 bytes |
コンパイル時間 | 1,362 ms |
コンパイル使用メモリ | 121,952 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-09-14 21:56:59 |
合計ジャッジ時間 | 10,937 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,376 KB |
testcase_02 | AC | 2 ms
5,376 KB |
testcase_03 | AC | 2 ms
5,376 KB |
testcase_04 | WA | - |
testcase_05 | WA | - |
testcase_06 | WA | - |
testcase_07 | WA | - |
testcase_08 | AC | 2 ms
5,376 KB |
testcase_09 | AC | 2 ms
5,376 KB |
testcase_10 | WA | - |
testcase_11 | AC | 2 ms
5,376 KB |
testcase_12 | AC | 2 ms
5,376 KB |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | AC | 2 ms
5,376 KB |
testcase_16 | AC | 2 ms
5,376 KB |
testcase_17 | AC | 2 ms
5,376 KB |
testcase_18 | AC | 2 ms
5,376 KB |
testcase_19 | AC | 2 ms
5,376 KB |
testcase_20 | AC | 2 ms
5,376 KB |
testcase_21 | AC | 2 ms
5,376 KB |
testcase_22 | AC | 2 ms
5,376 KB |
testcase_23 | AC | 2 ms
5,376 KB |
testcase_24 | AC | 2 ms
5,376 KB |
testcase_25 | AC | 2 ms
5,376 KB |
testcase_26 | AC | 2 ms
5,376 KB |
testcase_27 | AC | 2 ms
5,376 KB |
testcase_28 | AC | 2 ms
5,376 KB |
testcase_29 | AC | 2 ms
5,376 KB |
testcase_30 | AC | 2 ms
5,376 KB |
testcase_31 | AC | 2 ms
5,376 KB |
testcase_32 | AC | 2 ms
5,376 KB |
testcase_33 | AC | 2 ms
5,376 KB |
testcase_34 | AC | 2 ms
5,376 KB |
testcase_35 | AC | 2 ms
5,376 KB |
testcase_36 | AC | 2 ms
5,376 KB |
testcase_37 | AC | 2 ms
5,376 KB |
testcase_38 | WA | - |
testcase_39 | AC | 2 ms
5,376 KB |
testcase_40 | AC | 2 ms
5,376 KB |
testcase_41 | AC | 2 ms
5,376 KB |
testcase_42 | AC | 2 ms
5,376 KB |
testcase_43 | AC | 2 ms
5,376 KB |
testcase_44 | AC | 2 ms
5,376 KB |
testcase_45 | AC | 2 ms
5,376 KB |
testcase_46 | AC | 2 ms
5,376 KB |
testcase_47 | AC | 2 ms
5,376 KB |
testcase_48 | AC | 2 ms
5,376 KB |
testcase_49 | AC | 2 ms
5,376 KB |
testcase_50 | AC | 2 ms
5,376 KB |
testcase_51 | AC | 2 ms
5,376 KB |
testcase_52 | AC | 2 ms
5,376 KB |
testcase_53 | AC | 2 ms
5,376 KB |
testcase_54 | AC | 2 ms
5,376 KB |
testcase_55 | AC | 2 ms
5,376 KB |
testcase_56 | AC | 2 ms
5,376 KB |
testcase_57 | AC | 2 ms
5,376 KB |
testcase_58 | AC | 2 ms
5,376 KB |
testcase_59 | AC | 2 ms
5,376 KB |
testcase_60 | AC | 2 ms
5,376 KB |
testcase_61 | AC | 2 ms
5,376 KB |
testcase_62 | AC | 2 ms
5,376 KB |
testcase_63 | AC | 2 ms
5,376 KB |
testcase_64 | AC | 2 ms
5,376 KB |
testcase_65 | AC | 2 ms
5,376 KB |
testcase_66 | AC | 2 ms
5,376 KB |
testcase_67 | AC | 2 ms
5,376 KB |
testcase_68 | AC | 2 ms
5,376 KB |
testcase_69 | AC | 3 ms
5,376 KB |
testcase_70 | AC | 2 ms
5,376 KB |
testcase_71 | AC | 2 ms
5,376 KB |
testcase_72 | AC | 3 ms
5,376 KB |
testcase_73 | AC | 2 ms
5,376 KB |
testcase_74 | AC | 2 ms
5,376 KB |
testcase_75 | AC | 3 ms
5,376 KB |
testcase_76 | AC | 2 ms
5,376 KB |
testcase_77 | AC | 2 ms
5,376 KB |
testcase_78 | AC | 2 ms
5,376 KB |
testcase_79 | AC | 2 ms
5,376 KB |
testcase_80 | WA | - |
testcase_81 | WA | - |
testcase_82 | AC | 2 ms
5,376 KB |
testcase_83 | AC | 2 ms
5,376 KB |
testcase_84 | AC | 2 ms
5,376 KB |
testcase_85 | AC | 2 ms
5,376 KB |
testcase_86 | AC | 3 ms
5,376 KB |
testcase_87 | WA | - |
testcase_88 | WA | - |
testcase_89 | WA | - |
testcase_90 | WA | - |
testcase_91 | WA | - |
testcase_92 | AC | 2 ms
5,376 KB |
testcase_93 | AC | 2 ms
5,376 KB |
testcase_94 | WA | - |
testcase_95 | WA | - |
testcase_96 | WA | - |
testcase_97 | WA | - |
testcase_98 | AC | 2 ms
5,376 KB |
testcase_99 | AC | 2 ms
5,376 KB |
testcase_100 | WA | - |
testcase_101 | WA | - |
testcase_102 | WA | - |
testcase_103 | WA | - |
testcase_104 | AC | 2 ms
5,376 KB |
testcase_105 | AC | 2 ms
5,376 KB |
testcase_106 | WA | - |
testcase_107 | WA | - |
testcase_108 | WA | - |
testcase_109 | WA | - |
testcase_110 | AC | 2 ms
5,376 KB |
testcase_111 | AC | 2 ms
5,376 KB |
testcase_112 | WA | - |
testcase_113 | WA | - |
testcase_114 | WA | - |
testcase_115 | WA | - |
testcase_116 | WA | - |
testcase_117 | WA | - |
testcase_118 | AC | 2 ms
5,376 KB |
testcase_119 | AC | 2 ms
5,376 KB |
testcase_120 | WA | - |
testcase_121 | AC | 2 ms
5,376 KB |
testcase_122 | AC | 2 ms
5,376 KB |
testcase_123 | WA | - |
testcase_124 | AC | 2 ms
5,376 KB |
testcase_125 | AC | 2 ms
5,376 KB |
testcase_126 | AC | 2 ms
5,376 KB |
testcase_127 | AC | 3 ms
5,376 KB |
testcase_128 | AC | 28 ms
5,376 KB |
testcase_129 | AC | 75 ms
5,888 KB |
testcase_130 | AC | 54 ms
5,376 KB |
testcase_131 | AC | 92 ms
6,272 KB |
testcase_132 | AC | 75 ms
6,144 KB |
testcase_133 | AC | 3 ms
5,376 KB |
testcase_134 | AC | 22 ms
5,376 KB |
testcase_135 | AC | 27 ms
5,376 KB |
testcase_136 | AC | 27 ms
5,376 KB |
testcase_137 | AC | 42 ms
5,376 KB |
testcase_138 | AC | 55 ms
5,376 KB |
testcase_139 | AC | 64 ms
5,760 KB |
testcase_140 | AC | 88 ms
6,400 KB |
testcase_141 | AC | 84 ms
6,272 KB |
testcase_142 | AC | 37 ms
5,376 KB |
testcase_143 | AC | 55 ms
5,376 KB |
testcase_144 | WA | - |
testcase_145 | WA | - |
testcase_146 | WA | - |
testcase_147 | WA | - |
testcase_148 | AC | 32 ms
5,376 KB |
testcase_149 | AC | 48 ms
5,376 KB |
testcase_150 | AC | 69 ms
5,888 KB |
testcase_151 | AC | 5 ms
5,376 KB |
testcase_152 | AC | 60 ms
5,632 KB |
testcase_153 | AC | 90 ms
6,400 KB |
testcase_154 | AC | 4 ms
5,376 KB |
testcase_155 | AC | 62 ms
5,760 KB |
testcase_156 | AC | 22 ms
5,376 KB |
testcase_157 | AC | 62 ms
5,632 KB |
testcase_158 | AC | 82 ms
6,528 KB |
testcase_159 | AC | 12 ms
5,376 KB |
testcase_160 | AC | 5 ms
5,376 KB |
testcase_161 | AC | 72 ms
6,016 KB |
testcase_162 | AC | 78 ms
6,272 KB |
testcase_163 | AC | 43 ms
5,376 KB |
testcase_164 | AC | 83 ms
6,272 KB |
testcase_165 | AC | 66 ms
5,888 KB |
testcase_166 | AC | 13 ms
5,376 KB |
testcase_167 | AC | 41 ms
5,376 KB |
testcase_168 | AC | 29 ms
5,376 KB |
testcase_169 | AC | 32 ms
5,376 KB |
testcase_170 | AC | 24 ms
5,376 KB |
testcase_171 | AC | 41 ms
5,376 KB |
testcase_172 | AC | 31 ms
5,376 KB |
testcase_173 | AC | 8 ms
5,376 KB |
testcase_174 | AC | 71 ms
5,888 KB |
testcase_175 | AC | 91 ms
6,528 KB |
testcase_176 | AC | 61 ms
5,632 KB |
testcase_177 | AC | 10 ms
5,376 KB |
testcase_178 | AC | 64 ms
5,632 KB |
testcase_179 | AC | 68 ms
5,760 KB |
testcase_180 | AC | 84 ms
6,144 KB |
testcase_181 | AC | 19 ms
5,376 KB |
testcase_182 | AC | 37 ms
5,376 KB |
testcase_183 | AC | 51 ms
5,376 KB |
testcase_184 | AC | 39 ms
5,376 KB |
testcase_185 | AC | 62 ms
5,504 KB |
testcase_186 | AC | 76 ms
6,016 KB |
testcase_187 | AC | 58 ms
5,376 KB |
testcase_188 | AC | 2 ms
5,376 KB |
testcase_189 | AC | 2 ms
5,376 KB |
testcase_190 | WA | - |
testcase_191 | WA | - |
testcase_192 | WA | - |
testcase_193 | AC | 2 ms
5,376 KB |
testcase_194 | AC | 2 ms
5,376 KB |
testcase_195 | AC | 2 ms
5,376 KB |
testcase_196 | WA | - |
testcase_197 | WA | - |
testcase_198 | WA | - |
testcase_199 | WA | - |
testcase_200 | AC | 72 ms
5,888 KB |
testcase_201 | AC | 41 ms
5,376 KB |
testcase_202 | WA | - |
testcase_203 | WA | - |
testcase_204 | WA | - |
testcase_205 | WA | - |
testcase_206 | AC | 81 ms
6,272 KB |
testcase_207 | AC | 59 ms
5,632 KB |
testcase_208 | WA | - |
testcase_209 | WA | - |
testcase_210 | WA | - |
testcase_211 | WA | - |
testcase_212 | AC | 20 ms
5,376 KB |
testcase_213 | AC | 41 ms
5,376 KB |
testcase_214 | WA | - |
testcase_215 | WA | - |
testcase_216 | WA | - |
testcase_217 | WA | - |
testcase_218 | AC | 84 ms
6,400 KB |
testcase_219 | AC | 43 ms
5,376 KB |
ソースコード
#include <cstdio> #include <cstring> #include <iostream> #include <string> #include <cmath> #include <bitset> #include <vector> #include <map> #include <set> #include <queue> #include <deque> #include <algorithm> #include <complex> #include <unordered_map> #include <unordered_set> #include <random> #include <cassert> #include <fstream> #include <utility> #include <functional> #include <time.h> #include <stack> #include <array> #define popcount __builtin_popcount using namespace std; typedef long long int ll; typedef pair<int, int> P; int main() { ll w, h; cin>>w>>h; int n; cin>>n; ll x[100010], y[100010]; ll x1[100010], y1[100010]; for(int i=0; i<n; i++){ cin>>x[i]>>y[i]; x1[i]=x[i]+y[i], y1[i]=x[i]-y[i]; } sort(x1, x1+n); sort(y1, y1+n); ll d=max(x1[n-1]-x1[0], y1[n-1]-y1[0]); set<P> st; ll px[2], py[2]; if(d%2!=0){ cout<<0<<endl; return 0; } if(x1[0]==x1[n-1]){ sort(x, x+n); sort(y, y+n); cout<<x[0]*y[0]+(w-x[n-1]+1)*(h-y[n-1]+1)<<endl; return 0; } if(y1[0]==y1[n-1]){ sort(x, x+n); sort(y, y+n); cout<<(w-x[n-1]+1)*y[0]+x[0]*(h-y[n-1]+1)<<endl; return 0; } { px[0]=x1[n-1]-d/2, px[1]=x1[0]+d/2; py[0]=y1[n-1]-d/2, py[1]=y1[0]+d/2; for(int i=0; i<2; i++){ for(int j=0; j<2; j++){ ll x0=(px[i]+py[j])/2, y0=(px[i]-py[j])/2; if(x0*2!=px[i]+py[j]) continue; bool dame=0; for(int k=0; k<n; k++){ if(abs(x[k]-x0)+abs(y[k]-y0)!=abs(x[0]-x0)+abs(y[0]-y0)){ dame=1; break; } } if(!dame){ st.insert({x0, y0}); } } } } const ll INF=1e18; for(auto p:st){ ll x0=p.first, y0=p.second; y0+=INF; bool dame1=0, dame2=0; for(int k=0; k<n; k++){ if(abs(x[k]-x0)+abs(y[k]-y0)!=abs(x[0]-x0)+abs(y[0]-y0)){ dame1=1; break; } } y0-=2*INF; for(int k=0; k<n; k++){ if(abs(x[k]-x0)+abs(y[k]-y0)!=abs(x[0]-x0)+abs(y[0]-y0)){ dame2=1; break; } } y0+=INF; if(!dame1 && !dame2){ if(1<=x0 && x0<=w) cout<<h<<endl; else cout<<0<<endl; return 0; }else if(!dame1){ if(1<=x0 && x0<=w) cout<<max(0ll, h-y0+1)<<endl; else cout<<0<<endl; return 0; }else if(!dame2){ if(1<=x0 && x0<=w) cout<<max(0ll, y0)<<endl; else cout<<0<<endl; return 0; } x0+=INF; dame1=0, dame2=0; for(int k=0; k<n; k++){ if(abs(x[k]-x0)+abs(y[k]-y0)!=abs(x[0]-x0)+abs(y[0]-y0)){ dame1=1; break; } } x0-=2*INF; for(int k=0; k<n; k++){ if(abs(x[k]-x0)+abs(y[k]-y0)!=abs(x[0]-x0)+abs(y[0]-y0)){ dame2=1; break; } } x0+=INF; if(!dame1 && !dame2){ if(1<=y0 && y0<=h) cout<<w<<endl; else cout<<0<<endl; return 0; }else if(!dame1){ if(1<=y0 && y0<=h) cout<<max(0ll, w-x0+1)<<endl; else cout<<0<<endl; return 0; }else if(!dame2){ if(1<=y0 && y0<=h) cout<<max(0ll, x0)<<endl; else cout<<0<<endl; return 0; } } int ans=0; for(auto p:st){ if(1<=p.first && p.first<=w && 1<=p.second && p.second<=h){ ans++; } } cout<<ans<<endl; return 0; }