結果
問題 | No.8083 12歳 |
ユーザー | Kite_kuma |
提出日時 | 2021-04-01 21:00:15 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 12,183 bytes |
コンパイル時間 | 2,214 ms |
コンパイル使用メモリ | 202,944 KB |
実行使用メモリ | 5,248 KB |
最終ジャッジ日時 | 2024-12-21 04:54:39 |
合計ジャッジ時間 | 9,889 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
5,248 KB |
testcase_01 | AC | 2 ms
5,248 KB |
testcase_02 | AC | 2 ms
5,248 KB |
testcase_03 | AC | 2 ms
5,248 KB |
testcase_04 | AC | 2 ms
5,248 KB |
testcase_05 | AC | 2 ms
5,248 KB |
testcase_06 | AC | 2 ms
5,248 KB |
testcase_07 | AC | 2 ms
5,248 KB |
testcase_08 | AC | 2 ms
5,248 KB |
testcase_09 | AC | 2 ms
5,248 KB |
testcase_10 | AC | 2 ms
5,248 KB |
testcase_11 | AC | 2 ms
5,248 KB |
testcase_12 | AC | 3 ms
5,248 KB |
testcase_13 | AC | 2 ms
5,248 KB |
testcase_14 | AC | 1 ms
5,248 KB |
testcase_15 | AC | 2 ms
5,248 KB |
testcase_16 | AC | 2 ms
5,248 KB |
testcase_17 | AC | 2 ms
5,248 KB |
testcase_18 | AC | 2 ms
5,248 KB |
testcase_19 | AC | 2 ms
5,248 KB |
testcase_20 | AC | 2 ms
5,248 KB |
testcase_21 | AC | 2 ms
5,248 KB |
testcase_22 | AC | 2 ms
5,248 KB |
testcase_23 | AC | 2 ms
5,248 KB |
testcase_24 | AC | 2 ms
5,248 KB |
testcase_25 | AC | 2 ms
5,248 KB |
testcase_26 | AC | 2 ms
5,248 KB |
testcase_27 | AC | 2 ms
5,248 KB |
testcase_28 | AC | 2 ms
5,248 KB |
testcase_29 | AC | 2 ms
5,248 KB |
testcase_30 | AC | 2 ms
5,248 KB |
testcase_31 | AC | 2 ms
5,248 KB |
testcase_32 | AC | 2 ms
5,248 KB |
testcase_33 | AC | 2 ms
5,248 KB |
testcase_34 | AC | 1 ms
5,248 KB |
testcase_35 | AC | 2 ms
5,248 KB |
testcase_36 | AC | 2 ms
5,248 KB |
testcase_37 | AC | 2 ms
5,248 KB |
testcase_38 | AC | 2 ms
5,248 KB |
testcase_39 | AC | 3 ms
5,248 KB |
testcase_40 | AC | 2 ms
5,248 KB |
testcase_41 | AC | 2 ms
5,248 KB |
testcase_42 | AC | 2 ms
5,248 KB |
testcase_43 | AC | 2 ms
5,248 KB |
testcase_44 | AC | 2 ms
5,248 KB |
testcase_45 | AC | 2 ms
5,248 KB |
testcase_46 | AC | 2 ms
5,248 KB |
testcase_47 | AC | 2 ms
5,248 KB |
testcase_48 | AC | 2 ms
5,248 KB |
testcase_49 | AC | 2 ms
5,248 KB |
testcase_50 | AC | 2 ms
5,248 KB |
testcase_51 | AC | 2 ms
5,248 KB |
testcase_52 | AC | 2 ms
5,248 KB |
testcase_53 | AC | 1 ms
5,248 KB |
testcase_54 | AC | 3 ms
5,248 KB |
testcase_55 | AC | 2 ms
5,248 KB |
testcase_56 | AC | 2 ms
5,248 KB |
testcase_57 | AC | 2 ms
5,248 KB |
testcase_58 | AC | 2 ms
5,248 KB |
testcase_59 | AC | 2 ms
5,248 KB |
testcase_60 | AC | 2 ms
5,248 KB |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | AC | 2 ms
5,248 KB |
testcase_64 | AC | 2 ms
5,248 KB |
testcase_65 | AC | 2 ms
5,248 KB |
testcase_66 | WA | - |
testcase_67 | AC | 1 ms
5,248 KB |
testcase_68 | AC | 2 ms
5,248 KB |
testcase_69 | AC | 2 ms
5,248 KB |
testcase_70 | AC | 2 ms
5,248 KB |
testcase_71 | AC | 2 ms
5,248 KB |
testcase_72 | AC | 2 ms
5,248 KB |
testcase_73 | AC | 2 ms
5,248 KB |
testcase_74 | AC | 2 ms
5,248 KB |
testcase_75 | AC | 2 ms
5,248 KB |
testcase_76 | AC | 2 ms
5,248 KB |
testcase_77 | AC | 2 ms
5,248 KB |
testcase_78 | AC | 2 ms
5,248 KB |
testcase_79 | AC | 2 ms
5,248 KB |
testcase_80 | AC | 2 ms
5,248 KB |
testcase_81 | AC | 2 ms
5,248 KB |
testcase_82 | AC | 2 ms
5,248 KB |
testcase_83 | AC | 2 ms
5,248 KB |
testcase_84 | AC | 2 ms
5,248 KB |
testcase_85 | AC | 2 ms
5,248 KB |
testcase_86 | AC | 2 ms
5,248 KB |
testcase_87 | AC | 2 ms
5,248 KB |
testcase_88 | AC | 2 ms
5,248 KB |
testcase_89 | AC | 2 ms
5,248 KB |
testcase_90 | AC | 2 ms
5,248 KB |
testcase_91 | AC | 2 ms
5,248 KB |
testcase_92 | AC | 2 ms
5,248 KB |
testcase_93 | AC | 2 ms
5,248 KB |
testcase_94 | AC | 2 ms
5,248 KB |
testcase_95 | AC | 2 ms
5,248 KB |
testcase_96 | AC | 2 ms
5,248 KB |
testcase_97 | AC | 2 ms
5,248 KB |
testcase_98 | WA | - |
testcase_99 | WA | - |
testcase_100 | WA | - |
testcase_101 | WA | - |
testcase_102 | WA | - |
testcase_103 | AC | 2 ms
5,248 KB |
testcase_104 | WA | - |
testcase_105 | WA | - |
testcase_106 | WA | - |
testcase_107 | WA | - |
testcase_108 | WA | - |
testcase_109 | WA | - |
testcase_110 | WA | - |
testcase_111 | WA | - |
testcase_112 | WA | - |
testcase_113 | WA | - |
testcase_114 | WA | - |
testcase_115 | WA | - |
testcase_116 | AC | 1 ms
5,248 KB |
testcase_117 | WA | - |
testcase_118 | AC | 2 ms
5,248 KB |
testcase_119 | AC | 2 ms
5,248 KB |
testcase_120 | AC | 2 ms
5,248 KB |
testcase_121 | AC | 2 ms
5,248 KB |
testcase_122 | WA | - |
testcase_123 | AC | 2 ms
5,248 KB |
testcase_124 | AC | 2 ms
5,248 KB |
testcase_125 | AC | 2 ms
5,248 KB |
testcase_126 | WA | - |
testcase_127 | WA | - |
testcase_128 | AC | 2 ms
5,248 KB |
testcase_129 | AC | 2 ms
5,248 KB |
testcase_130 | WA | - |
testcase_131 | AC | 2 ms
5,248 KB |
testcase_132 | WA | - |
testcase_133 | WA | - |
testcase_134 | WA | - |
testcase_135 | WA | - |
testcase_136 | WA | - |
testcase_137 | WA | - |
testcase_138 | WA | - |
testcase_139 | WA | - |
testcase_140 | WA | - |
testcase_141 | WA | - |
testcase_142 | AC | 2 ms
5,248 KB |
testcase_143 | AC | 2 ms
5,248 KB |
testcase_144 | AC | 2 ms
5,248 KB |
testcase_145 | WA | - |
testcase_146 | WA | - |
testcase_147 | WA | - |
testcase_148 | WA | - |
testcase_149 | WA | - |
testcase_150 | WA | - |
testcase_151 | AC | 1 ms
5,248 KB |
testcase_152 | AC | 2 ms
5,248 KB |
testcase_153 | WA | - |
testcase_154 | WA | - |
testcase_155 | AC | 2 ms
5,248 KB |
testcase_156 | AC | 2 ms
5,248 KB |
testcase_157 | AC | 2 ms
5,248 KB |
testcase_158 | WA | - |
testcase_159 | WA | - |
testcase_160 | AC | 2 ms
5,248 KB |
testcase_161 | AC | 2 ms
5,248 KB |
testcase_162 | AC | 2 ms
5,248 KB |
testcase_163 | AC | 2 ms
5,248 KB |
testcase_164 | AC | 2 ms
5,248 KB |
testcase_165 | AC | 2 ms
5,248 KB |
testcase_166 | AC | 3 ms
5,248 KB |
testcase_167 | AC | 2 ms
5,248 KB |
testcase_168 | WA | - |
testcase_169 | AC | 2 ms
5,248 KB |
testcase_170 | AC | 2 ms
5,248 KB |
testcase_171 | AC | 2 ms
5,248 KB |
testcase_172 | AC | 2 ms
5,248 KB |
testcase_173 | AC | 2 ms
5,248 KB |
testcase_174 | AC | 2 ms
5,248 KB |
testcase_175 | AC | 2 ms
5,248 KB |
testcase_176 | AC | 2 ms
5,248 KB |
testcase_177 | AC | 2 ms
5,248 KB |
testcase_178 | AC | 2 ms
5,248 KB |
testcase_179 | AC | 2 ms
5,248 KB |
testcase_180 | AC | 2 ms
5,248 KB |
testcase_181 | AC | 2 ms
5,248 KB |
testcase_182 | AC | 2 ms
5,248 KB |
testcase_183 | AC | 2 ms
5,248 KB |
testcase_184 | AC | 2 ms
5,248 KB |
testcase_185 | AC | 3 ms
5,248 KB |
testcase_186 | AC | 2 ms
5,248 KB |
testcase_187 | AC | 2 ms
5,248 KB |
testcase_188 | AC | 3 ms
5,248 KB |
testcase_189 | AC | 2 ms
5,248 KB |
testcase_190 | AC | 2 ms
5,248 KB |
testcase_191 | AC | 2 ms
5,248 KB |
testcase_192 | AC | 2 ms
5,248 KB |
testcase_193 | AC | 2 ms
5,248 KB |
testcase_194 | AC | 2 ms
5,248 KB |
testcase_195 | AC | 2 ms
5,248 KB |
testcase_196 | AC | 2 ms
5,248 KB |
testcase_197 | AC | 2 ms
5,248 KB |
testcase_198 | AC | 2 ms
5,248 KB |
testcase_199 | AC | 2 ms
5,248 KB |
testcase_200 | AC | 3 ms
5,248 KB |
testcase_201 | AC | 2 ms
5,248 KB |
testcase_202 | AC | 2 ms
5,248 KB |
testcase_203 | AC | 2 ms
5,248 KB |
testcase_204 | AC | 2 ms
5,248 KB |
testcase_205 | AC | 2 ms
5,248 KB |
testcase_206 | AC | 2 ms
5,248 KB |
testcase_207 | AC | 2 ms
5,248 KB |
testcase_208 | AC | 2 ms
5,248 KB |
testcase_209 | AC | 2 ms
5,248 KB |
testcase_210 | AC | 2 ms
5,248 KB |
testcase_211 | AC | 2 ms
5,248 KB |
testcase_212 | AC | 2 ms
5,248 KB |
testcase_213 | AC | 2 ms
5,248 KB |
testcase_214 | AC | 2 ms
5,248 KB |
testcase_215 | AC | 2 ms
5,248 KB |
testcase_216 | AC | 2 ms
5,248 KB |
testcase_217 | AC | 2 ms
5,248 KB |
testcase_218 | AC | 3 ms
5,248 KB |
testcase_219 | AC | 2 ms
5,248 KB |
testcase_220 | AC | 2 ms
5,248 KB |
testcase_221 | AC | 2 ms
5,248 KB |
testcase_222 | AC | 2 ms
5,248 KB |
testcase_223 | AC | 2 ms
5,248 KB |
testcase_224 | AC | 3 ms
5,248 KB |
testcase_225 | AC | 2 ms
5,248 KB |
testcase_226 | AC | 2 ms
5,248 KB |
testcase_227 | AC | 2 ms
5,248 KB |
testcase_228 | AC | 2 ms
5,248 KB |
testcase_229 | AC | 2 ms
5,248 KB |
testcase_230 | AC | 2 ms
5,248 KB |
testcase_231 | AC | 2 ms
5,248 KB |
testcase_232 | WA | - |
testcase_233 | WA | - |
testcase_234 | AC | 2 ms
5,248 KB |
testcase_235 | AC | 3 ms
5,248 KB |
testcase_236 | AC | 2 ms
5,248 KB |
testcase_237 | WA | - |
testcase_238 | AC | 2 ms
5,248 KB |
testcase_239 | AC | 3 ms
5,248 KB |
testcase_240 | AC | 2 ms
5,248 KB |
testcase_241 | AC | 2 ms
5,248 KB |
testcase_242 | AC | 2 ms
5,248 KB |
testcase_243 | AC | 2 ms
5,248 KB |
testcase_244 | AC | 2 ms
5,248 KB |
testcase_245 | AC | 2 ms
5,248 KB |
testcase_246 | AC | 2 ms
5,248 KB |
testcase_247 | AC | 2 ms
5,248 KB |
testcase_248 | AC | 2 ms
5,248 KB |
testcase_249 | AC | 2 ms
5,248 KB |
testcase_250 | AC | 2 ms
5,248 KB |
testcase_251 | AC | 3 ms
5,248 KB |
testcase_252 | AC | 2 ms
5,248 KB |
testcase_253 | AC | 2 ms
5,248 KB |
testcase_254 | AC | 2 ms
5,248 KB |
testcase_255 | AC | 2 ms
5,248 KB |
testcase_256 | AC | 2 ms
5,248 KB |
testcase_257 | AC | 2 ms
5,248 KB |
testcase_258 | AC | 2 ms
5,248 KB |
testcase_259 | AC | 2 ms
5,248 KB |
testcase_260 | AC | 2 ms
5,248 KB |
testcase_261 | AC | 2 ms
5,248 KB |
testcase_262 | AC | 2 ms
5,248 KB |
testcase_263 | AC | 2 ms
5,248 KB |
testcase_264 | AC | 2 ms
5,248 KB |
testcase_265 | AC | 2 ms
5,248 KB |
testcase_266 | AC | 2 ms
5,248 KB |
testcase_267 | AC | 2 ms
5,248 KB |
testcase_268 | AC | 2 ms
5,248 KB |
testcase_269 | WA | - |
testcase_270 | WA | - |
testcase_271 | WA | - |
testcase_272 | WA | - |
testcase_273 | WA | - |
testcase_274 | AC | 2 ms
5,248 KB |
testcase_275 | WA | - |
testcase_276 | WA | - |
testcase_277 | WA | - |
testcase_278 | WA | - |
testcase_279 | WA | - |
testcase_280 | WA | - |
testcase_281 | WA | - |
testcase_282 | WA | - |
testcase_283 | WA | - |
testcase_284 | WA | - |
testcase_285 | WA | - |
testcase_286 | WA | - |
testcase_287 | AC | 2 ms
5,248 KB |
testcase_288 | WA | - |
testcase_289 | AC | 2 ms
5,248 KB |
testcase_290 | AC | 3 ms
5,248 KB |
testcase_291 | AC | 2 ms
5,248 KB |
testcase_292 | AC | 2 ms
5,248 KB |
testcase_293 | WA | - |
testcase_294 | AC | 2 ms
5,248 KB |
testcase_295 | AC | 2 ms
5,248 KB |
testcase_296 | AC | 2 ms
5,248 KB |
testcase_297 | WA | - |
testcase_298 | WA | - |
testcase_299 | AC | 2 ms
5,248 KB |
testcase_300 | AC | 2 ms
5,248 KB |
testcase_301 | WA | - |
testcase_302 | AC | 2 ms
5,248 KB |
testcase_303 | WA | - |
testcase_304 | WA | - |
testcase_305 | WA | - |
testcase_306 | WA | - |
testcase_307 | WA | - |
testcase_308 | WA | - |
testcase_309 | WA | - |
testcase_310 | WA | - |
testcase_311 | WA | - |
testcase_312 | WA | - |
testcase_313 | AC | 2 ms
5,248 KB |
testcase_314 | AC | 2 ms
5,248 KB |
testcase_315 | AC | 2 ms
5,248 KB |
testcase_316 | WA | - |
testcase_317 | WA | - |
testcase_318 | WA | - |
testcase_319 | WA | - |
testcase_320 | WA | - |
testcase_321 | WA | - |
testcase_322 | AC | 2 ms
5,248 KB |
testcase_323 | AC | 2 ms
5,248 KB |
testcase_324 | WA | - |
testcase_325 | WA | - |
testcase_326 | AC | 2 ms
5,248 KB |
testcase_327 | AC | 2 ms
5,248 KB |
testcase_328 | AC | 2 ms
5,248 KB |
testcase_329 | WA | - |
testcase_330 | WA | - |
testcase_331 | AC | 2 ms
5,248 KB |
testcase_332 | AC | 2 ms
5,248 KB |
testcase_333 | AC | 2 ms
5,248 KB |
testcase_334 | AC | 2 ms
5,248 KB |
testcase_335 | AC | 2 ms
5,248 KB |
testcase_336 | AC | 2 ms
5,248 KB |
testcase_337 | AC | 2 ms
5,248 KB |
testcase_338 | AC | 2 ms
5,248 KB |
testcase_339 | WA | - |
testcase_340 | AC | 2 ms
5,248 KB |
testcase_341 | AC | 2 ms
5,248 KB |
testcase_342 | AC | 2 ms
5,248 KB |
testcase_343 | AC | 2 ms
5,248 KB |
testcase_344 | AC | 2 ms
5,248 KB |
testcase_345 | AC | 2 ms
5,248 KB |
testcase_346 | AC | 2 ms
5,248 KB |
testcase_347 | AC | 2 ms
5,248 KB |
testcase_348 | AC | 2 ms
5,248 KB |
testcase_349 | AC | 2 ms
5,248 KB |
testcase_350 | AC | 2 ms
5,248 KB |
testcase_351 | AC | 2 ms
5,248 KB |
testcase_352 | AC | 2 ms
5,248 KB |
testcase_353 | AC | 2 ms
5,248 KB |
testcase_354 | AC | 2 ms
5,248 KB |
testcase_355 | AC | 2 ms
5,248 KB |
testcase_356 | AC | 2 ms
5,248 KB |
testcase_357 | AC | 2 ms
5,248 KB |
testcase_358 | AC | 2 ms
5,248 KB |
testcase_359 | AC | 2 ms
5,248 KB |
testcase_360 | AC | 2 ms
5,248 KB |
testcase_361 | WA | - |
testcase_362 | AC | 2 ms
5,248 KB |
testcase_363 | AC | 2 ms
5,248 KB |
testcase_364 | AC | 2 ms
5,248 KB |
testcase_365 | AC | 2 ms
5,248 KB |
ソースコード
/* author: Kite_kuma created: 2021.03.31 18:36:22 */ // #ifdef LOCAL // #define _GLIBCXX_DEBUG // #endif #include <bits/stdc++.h> using namespace std; #pragma region macros #define foa(s, v) for(auto &s : v) #define all(v) (v).begin(), (v).end() #define rall(v) (v).rbegin(), (v).rend() #define popcnt(n) __builtin_popcountll((long long)n) #define REPname(a, b, c, d, e, ...) e #define rep(...) REPname(__VA_ARGS__, REP3, REP2, REP1, REP0)(__VA_ARGS__) #define REP0(x) for(int Counter_in_rep_macro = 0; Counter_in_rep_macro < (x); ++Counter_in_rep_macro) #define REP1(i, x) for(int i = 0; i < (x); ++i) #define REP2(i, l, r) for(int i = (l); i < (r); ++i) #define REP3(i, l, r, c) for(int i = (l); i < (r); i += (c)) #define DREPname(a, b, c, d, e, ...) e #define drep(...) DREPname(__VA_ARGS__, DREP3, DREP2, DREP1)(__VA_ARGS__) #define DREP1(i, x) for(int i = (x)-1; i >= 0; --i) #define DREP2(i, l, r) for(int i = (r)-1; i >= (l); --i) #define DREP3(i, l, r, c) for(int i = (r)-1; i >= (l); i -= (c)) #pragma endregion #pragma region aliases using ll = long long; using ld = long double; using ull = unsigned long long; using vi = std::vector<int>; using vvi = std::vector<std::vector<int>>; using vvvi = std::vector<std::vector<std::vector<int>>>; using vll = std::vector<ll>; using vvll = std::vector<vll>; using vvvll = std::vector<vvll>; using pii = std::pair<int, int>; using pll = std::pair<long long, long long>; template <class T = ll> using V = std::vector<T>; template <class T = ll> using VV = V<V<T>>; template <class T = ll> using VVV = V<V<V<T>>>; template <class T = ll> using pqup = std::priority_queue<T, std::vector<T>, std::greater<T>>; template <class T = ll> using pqdn = std::priority_queue<T>; #pragma endregion #pragma region constants const int inf = 1e9; const long long INF = 1e18; const long double pi = acos(-1); const char dl = '\n'; const char sp = ' '; int dx[8] = {1, 0, -1, 0, 1, -1, -1, 1}; int dy[8] = {0, 1, 0, -1, 1, 1, -1, -1}; const int mod_1000000007 = 1000000007; const int mod_998244353 = 998244353; #pragma endregion #pragma region basic_operation template <class T0, class T1, class T2> inline bool in_range(T0 x, T1 lef, T2 rig) { return ((lef <= x) && (x < rig)); } template <class T> inline bool chmin(T &a, T b) { if(a > b) { a = b; return true; } return false; } template <class T> inline bool chmax(T &a, T b) { if(a < b) { a = b; return true; } return false; } void Yes(bool f = 1) { std::cout << (f ? "Yes" : "No") << '\n'; } void No() { std::cout << "No\n"; } void YES(bool f = 1) { std::cout << (f ? "YES" : "NO") << '\n'; } void NO() { std::cout << "NO\n"; } template <class T> void drop(T answer) { std::cout << answer << '\n'; exit(0); } void err(bool flag = true) { if(!flag) return; std::cout << -1 << '\n'; exit(0); } template <class T> void vout(std::vector<T> const &v, bool vertically = 0) { if(vertically) { for(auto const &a : v) { std::cout << a << '\n'; } return; } for(auto it = v.begin(); it != v.end(); it++) { std::cout << (*it); if(it != v.end() - 1) { std::cout << ' '; } } std::cout << '\n'; return; } inline void print() { std::cout << '\n'; } template <class T> inline void print(T x) { std::cout << x << '\n'; return; } template <typename Head, typename... Tail> void print(Head H, Tail... T) { std::cout << H << " "; print(T...); } template <class T> void add(std::vector<T> &v, T val) { for(auto &a : v) a += val; return; } template <class T> T dup(T a, T b) { assert(b != 0); return (a + b - 1) / b; } template <class T> T greatest_lower_multiple(T x, T d) { if(d == 0) return 0; if(d < 0) d *= -1; T y = x % d; if(y < 0) y += d; return x - y; } template <class T> T least_upper_multiple(T x, T d) { return -greatest_lower_multiple(-x, d); } long long POW(long long a, long long n) { long long res = 1; while(n > 0) { if(n & 1) res = res * a; a = a * a; n >>= 1; } return res; } long long modpow(long long a, long long n, long long mod) { // a^n mod assert(n >= 0 && mod); if(mod == 1) return 0LL; long long res = 1; while(n > 0) { if(n & 1) res = res * a % mod; a = a * a % mod; n >>= 1; } return res < 0 ? res + mod : res; } // return x which satisfies a * x % mod == gcd(a, mod) // not (mod | a) long long modinv(long long a, long long mod) { long long b = mod, u = 1, v = 0; while(b) { long long t = a / b; a -= t * b; std::swap(a, b); u -= t * v; std::swap(u, v); } u %= mod; if(u < 0) u += mod; return u; } template <class T> int lb(const std::vector<T> &a, const T x) { return std::distance(a.begin(), std::lower_bound(a.begin(), a.end(), x)); } template <class T> int ub(const std::vector<T> &a, const T x) { return std::distance(a.begin(), std::upper_bound(a.begin(), a.end(), x)); } template <class T> void unq_sort(std::vector<T> &a) { std::sort(a.begin(), a.end()); a.erase(std::unique(a.begin(), a.end()), a.end()); } template <class T> std::vector<int> press(std::vector<T> &a) { auto vec = a; unq_sort(vec); std::vector<int> ret; for(auto &v : a) ret.push_back(lb(vec, v)); return ret; } #pragma endregion #pragma region input #define VEC(type, name, size) \ vector<type> name(size); \ scanner::INPUT(name) #define VVEC(type, name, h, w) \ vector<vector<type>> name(h, vector<type>(w)); \ scanner::INPUT(name) #define INT(...) \ int __VA_ARGS__; \ scanner::INPUT(__VA_ARGS__) #define LL(...) \ long long __VA_ARGS__; \ scanner::INPUT(__VA_ARGS__) #define STR(...) \ string __VA_ARGS__; \ scanner::INPUT(__VA_ARGS__) #define CHR(...) \ char __VA_ARGS__; \ scanner::INPUT(__VA_ARGS__) #define DBL(...) \ double __VA_ARGS__; \ scanner::INPUT(__VA_ARGS__) #define LD(...) \ long double __VA_ARGS__; \ scanner::INPUT(__VA_ARGS__) #define TPL3(type0, type1, type2, name) \ std::tuple<type0, type1, type2> name; \ scanner::INPUT(name); #define TPL4(type0, type1, type2, type3, name) \ std::tuple<type0, type1, type2, type3> name; \ scanner::INPUT(name); namespace scanner { template <class T> void scan(T &a) { std::cin >> a; } template <class T, class L> void scan(std::pair<T, L> &p) { scan(p.first); scan(p.second); } template <class T0, class T1, class T2> void scan(std::tuple<T0, T1, T2> &p) { T0 t0; T1 t1; T2 t2; scan(t0); scan(t1); scan(t2); p = std::make_tuple(t0, t1, t2); } template <class T0, class T1, class T2, class T3> void scan(std::tuple<T0, T1, T2, T3> &p) { T0 t0; T1 t1; T2 t2; T3 t3; scan(t0); scan(t1); scan(t2); scan(t3); p = std::make_tuple(t0, t1, t2, t3); } template <class T> void scan(std::vector<T> &a) { for(auto &i : a) scan(i); } void INPUT() {} template <class Head, class... Tail> void INPUT(Head &head, Tail &...tail) { scan(head); INPUT(tail...); } } // namespace scanner template <typename T1, typename T2> std::istream &operator>>(std::istream &is, std::pair<T1, T2> &p) { is >> p.first >> p.second; return is; } #pragma endregion #pragma region debug #pragma region output template <typename T1, typename T2> std::ostream &std::operator<<(std::ostream &os, const std::pair<T1, T2> &p) { os << p.first << " " << p.second; return os; } template <class T> std::ostream &std::operator<<(std::ostream &os, const std::vector<T> &v) { for(int i = 0; i < (int)v.size(); i++) { if(i) os << " "; os << v[i]; } return os; } #pragma endregion #pragma region view namespace viewer { void view(const long long e) { if(e == INF) std::cerr << "INF"; else if(e == -INF) std::cerr << "-INF"; else std::cerr << e; } void view(const int e) { if(e == inf) std::cerr << "inf"; else if(e == -inf) std::cerr << "-inf"; else std::cerr << e; } template <typename T> void view(const T e) { std::cerr << e; } template <typename T, typename U> void view(const std::pair<T, U> &p) { std::cerr << "("; view(p.first); std::cerr << ", "; view(p.second); std::cerr << ")"; } template <class T0, class T1, class T2> void view(const std::tuple<T0, T1, T2> &p) { std::cerr << "("; view(std::get<0>(p)); std::cerr << ", "; view(std::get<1>(p)); std::cerr << ", "; view(std::get<2>(p)); std::cerr << ")"; } template <class T0, class T1, class T2, class T3> void view(const std::tuple<T0, T1, T2, T3> &p) { std::cerr << "("; view(std::get<0>(p)); std::cerr << ", "; view(std::get<1>(p)); std::cerr << ", "; view(std::get<2>(p)); std::cerr << ", "; view(std::get<3>(p)); std::cerr << ")"; } template <typename T> void view(const std::set<T> &s) { if(s.empty()) { std::cerr << "{ }"; return; } std::cerr << "{ "; for(auto &t : s) { view(t); std::cerr << ", "; } std::cerr << "\b\b }"; } template <typename T> void view(const std::unordered_set<T> &s) { if(s.empty()) { std::cerr << "{ }"; return; } std::cerr << "{ "; for(auto &t : s) { view(t); std::cerr << ", "; } std::cerr << "\b\b }"; } template <typename T> void view(const std::vector<T> &v) { if(v.empty()) { std::cerr << "{ }"; return; } std::cerr << "{ "; for(const auto &e : v) { view(e); std::cerr << ", "; } std::cerr << "\b\b }"; } template <typename T> void view(const std::vector<std::vector<T>> &vv) { std::cerr << "{\n"; for(const auto &v : vv) { std::cerr << "\t"; view(v); std::cerr << '\n'; } std::cerr << "}"; } template <typename T, typename U> void view(const std::vector<std::pair<T, U>> &v) { std::cerr << "{\n"; for(const auto &c : v) { std::cerr << "\t("; view(c.first); std::cerr << ", "; view(c.second); std::cerr << ")\n"; } std::cerr << "}"; } template <class T0, class T1, class T2> void view(const std::vector<std::tuple<T0, T1, T2>> &v) { if(v.empty()) { std::cerr << "{ }"; return; } std::cerr << '{'; for(const auto &t : v) { std::cerr << "\n\t"; view(t); std::cerr << ","; } std::cerr << "\n}"; } template <class T0, class T1, class T2, class T3> void view(const std::vector<std::tuple<T0, T1, T2, T3>> &v) { if(v.empty()) { std::cerr << "{ }"; return; } std::cerr << '{'; for(const auto &t : v) { std::cerr << "\n\t"; view(t); std::cerr << ","; } std::cerr << "\n}"; } template <typename T, typename U> void view(const std::map<T, U> &m) { std::cerr << "{\n"; for(const auto &t : m) { std::cerr << "\t["; view(t.first); std::cerr << "] : "; view(t.second); std::cerr << '\n'; } std::cerr << "}"; } template <typename T, typename U> void view(const std::unordered_map<T, U> &m) { std::cerr << "{\n"; for(const auto &t : m) { std::cerr << "\t["; view(t.first); std::cerr << "] : "; view(t.second); std::cerr << '\n'; } std::cerr << "}"; } } // namespace viewer #pragma endregion // when debugging : g++ foo.cpp -DLOCAL #ifdef LOCAL void debug_out() {} template <typename Head, typename... Tail> void debug_out(Head H, Tail... T) { viewer::view(H); std::cerr << ", "; debug_out(T...); } #define debug(...) \ do { \ std::cerr << __LINE__ << " [" << #__VA_ARGS__ << "] : ["; \ debug_out(__VA_ARGS__); \ std::cerr << "\b\b]\n"; \ } while(0) #define dump(x) \ do { \ std::cerr << __LINE__ << " " << #x << " : "; \ viewer::view(x); \ std::cerr << '\n'; \ } while(0) #else #define debug(...) (void(0)) #define dump(x) (void(0)) #endif #pragma endregion bool is_urudoshi(int year) { if(year % 400 == 0) return true; if(year % 100 == 0) return false; return year % 4 == 0; } int main() { std::ios::sync_with_stdio(false); std::cin.tie(nullptr); std::cout << std::fixed << std::setprecision(15); srand((unsigned)time(NULL)); INT(y, n, d); int uru = is_urudoshi(y - 12); // int to_uru = 365 - 31 - 1 + 1; int thisis366 = is_urudoshi(y + 1); int mini, maxi; mini = max(0, n - d); int nokori = 365 - d; if(thisis366 && uru && nokori >= 33) nokori++; maxi = min(nokori, n); print(mini, maxi); return 0; }