結果
問題 | No.960 マンハッタン距離3 |
ユーザー | 👑 emthrm |
提出日時 | 2019-12-28 20:57:30 |
言語 | C++17 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 3,501 bytes |
コンパイル時間 | 1,444 ms |
コンパイル使用メモリ | 126,040 KB |
実行使用メモリ | 6,824 KB |
最終ジャッジ日時 | 2024-10-12 13:40:28 |
合計ジャッジ時間 | 11,073 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge3 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | WA | - |
testcase_01 | AC | 2 ms
6,820 KB |
testcase_02 | WA | - |
testcase_03 | AC | 2 ms
6,816 KB |
testcase_04 | AC | 2 ms
6,816 KB |
testcase_05 | AC | 2 ms
6,816 KB |
testcase_06 | AC | 2 ms
6,816 KB |
testcase_07 | WA | - |
testcase_08 | AC | 2 ms
6,820 KB |
testcase_09 | AC | 2 ms
6,820 KB |
testcase_10 | AC | 2 ms
6,816 KB |
testcase_11 | AC | 2 ms
6,820 KB |
testcase_12 | AC | 2 ms
6,816 KB |
testcase_13 | AC | 2 ms
6,816 KB |
testcase_14 | WA | - |
testcase_15 | AC | 2 ms
6,820 KB |
testcase_16 | AC | 2 ms
6,820 KB |
testcase_17 | AC | 2 ms
6,816 KB |
testcase_18 | WA | - |
testcase_19 | AC | 2 ms
6,820 KB |
testcase_20 | AC | 2 ms
6,820 KB |
testcase_21 | AC | 2 ms
6,816 KB |
testcase_22 | WA | - |
testcase_23 | WA | - |
testcase_24 | WA | - |
testcase_25 | WA | - |
testcase_26 | AC | 2 ms
6,816 KB |
testcase_27 | WA | - |
testcase_28 | AC | 2 ms
6,816 KB |
testcase_29 | AC | 2 ms
6,816 KB |
testcase_30 | WA | - |
testcase_31 | AC | 2 ms
6,820 KB |
testcase_32 | AC | 2 ms
6,820 KB |
testcase_33 | AC | 2 ms
6,816 KB |
testcase_34 | AC | 2 ms
6,816 KB |
testcase_35 | AC | 2 ms
6,816 KB |
testcase_36 | WA | - |
testcase_37 | WA | - |
testcase_38 | WA | - |
testcase_39 | WA | - |
testcase_40 | AC | 2 ms
6,820 KB |
testcase_41 | AC | 2 ms
6,816 KB |
testcase_42 | AC | 2 ms
6,820 KB |
testcase_43 | AC | 2 ms
6,816 KB |
testcase_44 | AC | 2 ms
6,816 KB |
testcase_45 | AC | 2 ms
6,816 KB |
testcase_46 | AC | 2 ms
6,820 KB |
testcase_47 | AC | 2 ms
6,816 KB |
testcase_48 | AC | 2 ms
6,816 KB |
testcase_49 | AC | 2 ms
6,816 KB |
testcase_50 | WA | - |
testcase_51 | AC | 2 ms
6,820 KB |
testcase_52 | WA | - |
testcase_53 | AC | 2 ms
6,820 KB |
testcase_54 | AC | 2 ms
6,820 KB |
testcase_55 | AC | 2 ms
6,816 KB |
testcase_56 | AC | 2 ms
6,820 KB |
testcase_57 | AC | 2 ms
6,816 KB |
testcase_58 | AC | 1 ms
6,820 KB |
testcase_59 | AC | 2 ms
6,816 KB |
testcase_60 | AC | 2 ms
6,816 KB |
testcase_61 | AC | 2 ms
6,820 KB |
testcase_62 | AC | 2 ms
6,816 KB |
testcase_63 | AC | 2 ms
6,816 KB |
testcase_64 | AC | 2 ms
6,816 KB |
testcase_65 | AC | 2 ms
6,820 KB |
testcase_66 | AC | 2 ms
6,816 KB |
testcase_67 | AC | 2 ms
6,820 KB |
testcase_68 | AC | 2 ms
6,816 KB |
testcase_69 | AC | 2 ms
6,820 KB |
testcase_70 | AC | 2 ms
6,820 KB |
testcase_71 | AC | 2 ms
6,816 KB |
testcase_72 | AC | 2 ms
6,816 KB |
testcase_73 | AC | 2 ms
6,816 KB |
testcase_74 | AC | 2 ms
6,820 KB |
testcase_75 | AC | 2 ms
6,820 KB |
testcase_76 | AC | 2 ms
6,816 KB |
testcase_77 | AC | 2 ms
6,816 KB |
testcase_78 | AC | 2 ms
6,820 KB |
testcase_79 | AC | 2 ms
6,816 KB |
testcase_80 | WA | - |
testcase_81 | AC | 2 ms
6,820 KB |
testcase_82 | AC | 2 ms
6,820 KB |
testcase_83 | AC | 2 ms
6,820 KB |
testcase_84 | AC | 2 ms
6,816 KB |
testcase_85 | AC | 2 ms
6,816 KB |
testcase_86 | AC | 2 ms
6,816 KB |
testcase_87 | AC | 2 ms
6,816 KB |
testcase_88 | WA | - |
testcase_89 | AC | 2 ms
6,820 KB |
testcase_90 | AC | 2 ms
6,820 KB |
testcase_91 | AC | 2 ms
6,820 KB |
testcase_92 | AC | 2 ms
6,820 KB |
testcase_93 | AC | 2 ms
6,816 KB |
testcase_94 | WA | - |
testcase_95 | WA | - |
testcase_96 | WA | - |
testcase_97 | WA | - |
testcase_98 | AC | 2 ms
6,816 KB |
testcase_99 | AC | 2 ms
6,816 KB |
testcase_100 | WA | - |
testcase_101 | WA | - |
testcase_102 | WA | - |
testcase_103 | AC | 2 ms
6,816 KB |
testcase_104 | AC | 2 ms
6,824 KB |
testcase_105 | AC | 2 ms
6,820 KB |
testcase_106 | WA | - |
testcase_107 | WA | - |
testcase_108 | WA | - |
testcase_109 | WA | - |
testcase_110 | AC | 2 ms
6,816 KB |
testcase_111 | AC | 2 ms
6,816 KB |
testcase_112 | AC | 2 ms
6,820 KB |
testcase_113 | AC | 2 ms
6,816 KB |
testcase_114 | WA | - |
testcase_115 | AC | 2 ms
6,816 KB |
testcase_116 | AC | 2 ms
6,816 KB |
testcase_117 | WA | - |
testcase_118 | AC | 2 ms
6,820 KB |
testcase_119 | AC | 2 ms
6,816 KB |
testcase_120 | AC | 2 ms
6,816 KB |
testcase_121 | AC | 1 ms
6,816 KB |
testcase_122 | AC | 2 ms
6,820 KB |
testcase_123 | AC | 1 ms
6,816 KB |
testcase_124 | AC | 1 ms
6,820 KB |
testcase_125 | AC | 2 ms
6,816 KB |
testcase_126 | AC | 2 ms
6,820 KB |
testcase_127 | WA | - |
testcase_128 | AC | 9 ms
6,816 KB |
testcase_129 | AC | 23 ms
6,820 KB |
testcase_130 | AC | 16 ms
6,816 KB |
testcase_131 | AC | 26 ms
6,816 KB |
testcase_132 | WA | - |
testcase_133 | WA | - |
testcase_134 | AC | 8 ms
6,816 KB |
testcase_135 | WA | - |
testcase_136 | WA | - |
testcase_137 | AC | 12 ms
6,816 KB |
testcase_138 | WA | - |
testcase_139 | WA | - |
testcase_140 | AC | 24 ms
6,820 KB |
testcase_141 | WA | - |
testcase_142 | WA | - |
testcase_143 | AC | 14 ms
6,820 KB |
testcase_144 | WA | - |
testcase_145 | WA | - |
testcase_146 | WA | - |
testcase_147 | WA | - |
testcase_148 | AC | 12 ms
6,816 KB |
testcase_149 | AC | 18 ms
6,820 KB |
testcase_150 | AC | 24 ms
6,816 KB |
testcase_151 | AC | 3 ms
6,816 KB |
testcase_152 | AC | 17 ms
6,816 KB |
testcase_153 | AC | 23 ms
6,816 KB |
testcase_154 | AC | 2 ms
6,820 KB |
testcase_155 | AC | 23 ms
6,820 KB |
testcase_156 | AC | 9 ms
6,820 KB |
testcase_157 | AC | 24 ms
6,816 KB |
testcase_158 | WA | - |
testcase_159 | WA | - |
testcase_160 | WA | - |
testcase_161 | WA | - |
testcase_162 | AC | 22 ms
6,820 KB |
testcase_163 | AC | 13 ms
6,820 KB |
testcase_164 | AC | 30 ms
6,820 KB |
testcase_165 | AC | 24 ms
6,816 KB |
testcase_166 | AC | 6 ms
6,816 KB |
testcase_167 | AC | 15 ms
6,816 KB |
testcase_168 | AC | 12 ms
6,816 KB |
testcase_169 | AC | 14 ms
6,820 KB |
testcase_170 | AC | 11 ms
6,816 KB |
testcase_171 | AC | 19 ms
6,820 KB |
testcase_172 | AC | 13 ms
6,816 KB |
testcase_173 | AC | 4 ms
6,820 KB |
testcase_174 | AC | 24 ms
6,816 KB |
testcase_175 | AC | 30 ms
6,820 KB |
testcase_176 | AC | 22 ms
6,820 KB |
testcase_177 | AC | 4 ms
6,824 KB |
testcase_178 | AC | 21 ms
6,816 KB |
testcase_179 | AC | 23 ms
6,820 KB |
testcase_180 | AC | 21 ms
6,816 KB |
testcase_181 | AC | 6 ms
6,816 KB |
testcase_182 | AC | 11 ms
6,820 KB |
testcase_183 | AC | 14 ms
6,820 KB |
testcase_184 | AC | 11 ms
6,820 KB |
testcase_185 | AC | 16 ms
6,820 KB |
testcase_186 | AC | 19 ms
6,816 KB |
testcase_187 | AC | 15 ms
6,816 KB |
testcase_188 | AC | 2 ms
6,820 KB |
testcase_189 | AC | 2 ms
6,816 KB |
testcase_190 | AC | 2 ms
6,820 KB |
testcase_191 | AC | 2 ms
6,820 KB |
testcase_192 | AC | 2 ms
6,816 KB |
testcase_193 | AC | 2 ms
6,816 KB |
testcase_194 | AC | 2 ms
6,816 KB |
testcase_195 | AC | 2 ms
6,816 KB |
testcase_196 | WA | - |
testcase_197 | AC | 6 ms
6,816 KB |
testcase_198 | AC | 14 ms
6,816 KB |
testcase_199 | AC | 20 ms
6,816 KB |
testcase_200 | AC | 19 ms
6,816 KB |
testcase_201 | AC | 12 ms
6,816 KB |
testcase_202 | WA | - |
testcase_203 | WA | - |
testcase_204 | WA | - |
testcase_205 | WA | - |
testcase_206 | AC | 21 ms
6,816 KB |
testcase_207 | AC | 16 ms
6,820 KB |
testcase_208 | WA | - |
testcase_209 | WA | - |
testcase_210 | WA | - |
testcase_211 | WA | - |
testcase_212 | AC | 7 ms
6,816 KB |
testcase_213 | AC | 12 ms
6,820 KB |
testcase_214 | WA | - |
testcase_215 | WA | - |
testcase_216 | WA | - |
testcase_217 | WA | - |
testcase_218 | AC | 22 ms
6,816 KB |
testcase_219 | AC | 13 ms
6,820 KB |
ソースコード
#include <algorithm> #include <bitset> #include <cassert> #include <cctype> #include <chrono> #define _USE_MATH_DEFINES #include <cmath> #include <cstring> #include <ctime> #include <deque> #include <functional> #include <iomanip> #include <iostream> #include <iterator> #include <map> #include <numeric> #include <queue> #include <set> #include <sstream> #include <stack> #include <string> #include <tuple> #include <utility> #include <vector> using namespace std; #define FOR(i,m,n) for(int i=(m);i<(n);++i) #define REP(i,n) FOR(i,0,n) #define ALL(v) (v).begin(),(v).end() const int INF = 0x3f3f3f3f; const long long LINF = 0x3f3f3f3f3f3f3f3fLL; const double EPS = 1e-8; const int MOD = 1000000007; // const int MOD = 998244353; const int dy[] = {1, 0, -1, 0}, dx[] = {0, -1, 0, 1}; // const int dy[] = {1, 1, 0, -1, -1, -1, 0, 1}, // dx[] = {0, -1, -1, -1, 0, 1, 1, 1}; struct IOSetup { IOSetup() { cin.tie(nullptr); ios_base::sync_with_stdio(false); cout << fixed << setprecision(20); cerr << fixed << setprecision(10); } } iosetup; /*-------------------------------------------------*/ int main() { long long w, h; int n; cin >> w >> h >> n; vector<long long> x(n), y(n); REP(i, n) cin >> x[i] >> y[i]; FOR(i, 1, n) { if ((x[0] + y[0]) % 2 != (x[i] + y[i]) % 2) { cout << "0\n"; return 0; } } long long ans = 0; REP(rot, 4) { REP(flip, 2) { long long mn_x = LINF, mx_x = -LINF, mn_y = LINF, mx_y = -LINF, mn_plus = LINF, mx_plus = -LINF, mn_minus = LINF, mx_minus = -LINF; REP(i, n) { mn_x = min(mn_x, x[i]); mx_x = max(mx_x, x[i]); mn_y = min(mn_y, y[i]); mx_y = max(mx_y, y[i]); mn_plus = min(mn_plus, x[i] + y[i]); mx_plus = max(mx_plus, x[i] + y[i]); mn_minus = min(mn_minus, x[i] - y[i]); mx_minus = max(mx_minus, x[i] - y[i]); } if (n == 2) { if (mn_plus == mx_plus) ans = max(ans, mn_x * mn_y + (w - mx_x + 1) * (h - mx_y + 1) + mx_x - mn_x - 1); if (mx_x - mn_x < mx_y - mn_y) ans = max(ans, w); } else { if (mn_plus == mx_plus) ans = max(ans, mn_x * mn_y + (w - mx_x + 1) * (h - mx_y + 1)); bool flag = true; if (mx_plus - mn_plus >= mx_minus - mn_minus) { REP(i, n) flag &= x[i] + y[i] == mx_plus || x[i] + y[i] == mn_plus; if (flag) ans = max(ans, ((mx_plus - mx_minus) - (mx_minus - mn_minus)) / 2 + 1); } flag = true; int cnt = 0; REP(i, n) { if (x[i] + y[i] != mx_plus) { ++cnt; flag &= x[i] - y[i] == mx_minus; } } if (flag && cnt == 1) { long long tmp = LINF; REP(i, n) if (x[i] + y[i] == mx_plus) tmp = min(tmp, x[i]); ans = max(ans, tmp); } if (mx_plus - mn_plus >= mx_minus - mn_minus) { flag = true; REP(i, n) flag &= x[i] + y[i] == mx_plus || x[i] + y[i] == mn_plus || x[i] - y[i] == mx_minus; if (flag) ans = max(ans, 1LL); } if (mx_plus - mn_plus == mx_minus - mn_minus) { flag = true; REP(i, n) flag &= x[i] + y[i] == mx_plus || x[i] + y[i] == mn_plus || x[i] - y[i] == mx_minus || x[i] - y[i] == mn_minus; if (flag) ans = max(ans, 1LL); } } REP(i, n) y[i] = h - y[i] + 1; } REP(i, n) { swap(x[i], y[i]); (y[i] *= -1) += h + 1; swap(h, w); } } cout << ans << '\n'; return 0; }