結果
問題 | No.8083 12歳 |
ユーザー | torisasami4 |
提出日時 | 2021-04-01 21:14:56 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 5,937 bytes |
コンパイル時間 | 2,048 ms |
コンパイル使用メモリ | 180,780 KB |
実行使用メモリ | 39,856 KB |
最終ジャッジ日時 | 2024-12-21 05:14:33 |
合計ジャッジ時間 | 15,377 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 14 ms
39,648 KB |
testcase_01 | AC | 14 ms
39,680 KB |
testcase_02 | AC | 14 ms
39,620 KB |
testcase_03 | AC | 15 ms
39,648 KB |
testcase_04 | AC | 15 ms
39,680 KB |
testcase_05 | AC | 15 ms
39,656 KB |
testcase_06 | AC | 19 ms
39,628 KB |
testcase_07 | AC | 15 ms
39,636 KB |
testcase_08 | AC | 14 ms
39,708 KB |
testcase_09 | AC | 15 ms
39,728 KB |
testcase_10 | AC | 13 ms
39,716 KB |
testcase_11 | AC | 15 ms
39,652 KB |
testcase_12 | AC | 13 ms
39,616 KB |
testcase_13 | AC | 14 ms
39,800 KB |
testcase_14 | AC | 14 ms
39,632 KB |
testcase_15 | AC | 14 ms
39,648 KB |
testcase_16 | AC | 15 ms
39,652 KB |
testcase_17 | AC | 16 ms
39,732 KB |
testcase_18 | AC | 15 ms
39,624 KB |
testcase_19 | AC | 15 ms
39,656 KB |
testcase_20 | AC | 13 ms
39,624 KB |
testcase_21 | AC | 16 ms
39,620 KB |
testcase_22 | AC | 13 ms
39,636 KB |
testcase_23 | AC | 15 ms
39,636 KB |
testcase_24 | AC | 12 ms
39,628 KB |
testcase_25 | AC | 13 ms
39,636 KB |
testcase_26 | AC | 13 ms
39,652 KB |
testcase_27 | AC | 13 ms
39,684 KB |
testcase_28 | AC | 13 ms
39,644 KB |
testcase_29 | AC | 14 ms
39,664 KB |
testcase_30 | AC | 13 ms
39,816 KB |
testcase_31 | AC | 12 ms
39,628 KB |
testcase_32 | AC | 15 ms
39,716 KB |
testcase_33 | AC | 14 ms
39,804 KB |
testcase_34 | AC | 17 ms
39,720 KB |
testcase_35 | AC | 16 ms
39,736 KB |
testcase_36 | AC | 13 ms
39,624 KB |
testcase_37 | AC | 13 ms
39,648 KB |
testcase_38 | AC | 16 ms
39,820 KB |
testcase_39 | AC | 14 ms
39,628 KB |
testcase_40 | AC | 16 ms
39,620 KB |
testcase_41 | AC | 14 ms
39,712 KB |
testcase_42 | AC | 13 ms
39,704 KB |
testcase_43 | AC | 13 ms
39,624 KB |
testcase_44 | AC | 16 ms
39,636 KB |
testcase_45 | AC | 14 ms
39,700 KB |
testcase_46 | AC | 15 ms
39,628 KB |
testcase_47 | AC | 14 ms
39,656 KB |
testcase_48 | AC | 14 ms
39,672 KB |
testcase_49 | AC | 16 ms
39,668 KB |
testcase_50 | AC | 15 ms
39,700 KB |
testcase_51 | AC | 16 ms
39,624 KB |
testcase_52 | AC | 15 ms
39,656 KB |
testcase_53 | AC | 17 ms
39,664 KB |
testcase_54 | AC | 15 ms
39,720 KB |
testcase_55 | AC | 15 ms
39,676 KB |
testcase_56 | AC | 16 ms
39,656 KB |
testcase_57 | AC | 14 ms
39,644 KB |
testcase_58 | AC | 16 ms
39,624 KB |
testcase_59 | AC | 15 ms
39,644 KB |
testcase_60 | AC | 13 ms
39,648 KB |
testcase_61 | WA | - |
testcase_62 | WA | - |
testcase_63 | AC | 16 ms
39,656 KB |
testcase_64 | AC | 14 ms
39,656 KB |
testcase_65 | AC | 15 ms
39,716 KB |
testcase_66 | WA | - |
testcase_67 | AC | 13 ms
39,656 KB |
testcase_68 | AC | 14 ms
39,668 KB |
testcase_69 | AC | 15 ms
39,688 KB |
testcase_70 | AC | 14 ms
39,660 KB |
testcase_71 | AC | 13 ms
39,652 KB |
testcase_72 | AC | 13 ms
39,704 KB |
testcase_73 | AC | 13 ms
39,732 KB |
testcase_74 | AC | 17 ms
39,676 KB |
testcase_75 | AC | 16 ms
39,708 KB |
testcase_76 | AC | 14 ms
39,668 KB |
testcase_77 | AC | 15 ms
39,644 KB |
testcase_78 | AC | 13 ms
39,628 KB |
testcase_79 | AC | 15 ms
39,628 KB |
testcase_80 | AC | 13 ms
39,692 KB |
testcase_81 | AC | 15 ms
39,688 KB |
testcase_82 | AC | 14 ms
39,688 KB |
testcase_83 | AC | 15 ms
39,716 KB |
testcase_84 | AC | 14 ms
39,640 KB |
testcase_85 | AC | 14 ms
39,672 KB |
testcase_86 | AC | 14 ms
39,676 KB |
testcase_87 | AC | 14 ms
39,780 KB |
testcase_88 | AC | 14 ms
39,696 KB |
testcase_89 | AC | 13 ms
39,644 KB |
testcase_90 | AC | 18 ms
39,632 KB |
testcase_91 | AC | 15 ms
39,676 KB |
testcase_92 | AC | 13 ms
39,628 KB |
testcase_93 | AC | 17 ms
39,636 KB |
testcase_94 | AC | 15 ms
39,728 KB |
testcase_95 | AC | 14 ms
39,664 KB |
testcase_96 | AC | 13 ms
39,660 KB |
testcase_97 | AC | 15 ms
39,644 KB |
testcase_98 | WA | - |
testcase_99 | WA | - |
testcase_100 | WA | - |
testcase_101 | WA | - |
testcase_102 | WA | - |
testcase_103 | AC | 14 ms
39,640 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 | 13 ms
39,644 KB |
testcase_117 | AC | 14 ms
39,648 KB |
testcase_118 | WA | - |
testcase_119 | WA | - |
testcase_120 | AC | 14 ms
39,640 KB |
testcase_121 | AC | 17 ms
39,700 KB |
testcase_122 | AC | 17 ms
39,708 KB |
testcase_123 | WA | - |
testcase_124 | AC | 15 ms
39,680 KB |
testcase_125 | AC | 14 ms
39,684 KB |
testcase_126 | AC | 13 ms
39,676 KB |
testcase_127 | AC | 14 ms
39,720 KB |
testcase_128 | AC | 14 ms
39,640 KB |
testcase_129 | AC | 14 ms
39,684 KB |
testcase_130 | AC | 14 ms
39,624 KB |
testcase_131 | AC | 15 ms
39,656 KB |
testcase_132 | AC | 12 ms
39,696 KB |
testcase_133 | AC | 14 ms
39,640 KB |
testcase_134 | AC | 14 ms
39,676 KB |
testcase_135 | AC | 13 ms
39,640 KB |
testcase_136 | AC | 14 ms
39,720 KB |
testcase_137 | AC | 14 ms
39,632 KB |
testcase_138 | AC | 13 ms
39,704 KB |
testcase_139 | AC | 16 ms
39,664 KB |
testcase_140 | AC | 14 ms
39,700 KB |
testcase_141 | AC | 14 ms
39,636 KB |
testcase_142 | AC | 14 ms
39,620 KB |
testcase_143 | AC | 14 ms
39,648 KB |
testcase_144 | AC | 15 ms
39,724 KB |
testcase_145 | AC | 13 ms
39,628 KB |
testcase_146 | AC | 14 ms
39,656 KB |
testcase_147 | AC | 13 ms
39,636 KB |
testcase_148 | AC | 14 ms
39,616 KB |
testcase_149 | AC | 13 ms
39,628 KB |
testcase_150 | WA | - |
testcase_151 | AC | 14 ms
39,680 KB |
testcase_152 | AC | 14 ms
39,704 KB |
testcase_153 | AC | 13 ms
39,620 KB |
testcase_154 | AC | 14 ms
39,636 KB |
testcase_155 | WA | - |
testcase_156 | WA | - |
testcase_157 | WA | - |
testcase_158 | WA | - |
testcase_159 | WA | - |
testcase_160 | AC | 13 ms
39,628 KB |
testcase_161 | WA | - |
testcase_162 | WA | - |
testcase_163 | WA | - |
testcase_164 | WA | - |
testcase_165 | WA | - |
testcase_166 | WA | - |
testcase_167 | WA | - |
testcase_168 | WA | - |
testcase_169 | WA | - |
testcase_170 | WA | - |
testcase_171 | WA | - |
testcase_172 | WA | - |
testcase_173 | AC | 13 ms
39,680 KB |
testcase_174 | WA | - |
testcase_175 | WA | - |
testcase_176 | WA | - |
testcase_177 | AC | 14 ms
39,628 KB |
testcase_178 | AC | 13 ms
39,696 KB |
testcase_179 | AC | 14 ms
39,616 KB |
testcase_180 | AC | 14 ms
39,616 KB |
testcase_181 | AC | 13 ms
39,732 KB |
testcase_182 | AC | 12 ms
39,680 KB |
testcase_183 | AC | 16 ms
39,656 KB |
testcase_184 | WA | - |
testcase_185 | AC | 13 ms
39,692 KB |
testcase_186 | AC | 13 ms
39,704 KB |
testcase_187 | WA | - |
testcase_188 | AC | 13 ms
39,692 KB |
testcase_189 | WA | - |
testcase_190 | WA | - |
testcase_191 | AC | 14 ms
39,712 KB |
testcase_192 | WA | - |
testcase_193 | WA | - |
testcase_194 | WA | - |
testcase_195 | AC | 12 ms
39,616 KB |
testcase_196 | AC | 11 ms
39,720 KB |
testcase_197 | WA | - |
testcase_198 | WA | - |
testcase_199 | AC | 12 ms
39,668 KB |
testcase_200 | AC | 13 ms
39,668 KB |
testcase_201 | AC | 12 ms
39,652 KB |
testcase_202 | AC | 13 ms
39,636 KB |
testcase_203 | WA | - |
testcase_204 | AC | 11 ms
39,636 KB |
testcase_205 | AC | 12 ms
39,676 KB |
testcase_206 | WA | - |
testcase_207 | AC | 14 ms
39,652 KB |
testcase_208 | AC | 13 ms
39,632 KB |
testcase_209 | AC | 13 ms
39,732 KB |
testcase_210 | AC | 14 ms
39,708 KB |
testcase_211 | WA | - |
testcase_212 | WA | - |
testcase_213 | AC | 14 ms
39,636 KB |
testcase_214 | AC | 13 ms
39,644 KB |
testcase_215 | WA | - |
testcase_216 | AC | 13 ms
39,804 KB |
testcase_217 | AC | 13 ms
39,664 KB |
testcase_218 | WA | - |
testcase_219 | AC | 13 ms
39,736 KB |
testcase_220 | AC | 13 ms
39,676 KB |
testcase_221 | AC | 14 ms
39,628 KB |
testcase_222 | AC | 14 ms
39,736 KB |
testcase_223 | AC | 13 ms
39,708 KB |
testcase_224 | WA | - |
testcase_225 | AC | 13 ms
39,620 KB |
testcase_226 | WA | - |
testcase_227 | AC | 14 ms
39,660 KB |
testcase_228 | AC | 13 ms
39,624 KB |
testcase_229 | AC | 17 ms
39,676 KB |
testcase_230 | AC | 13 ms
39,632 KB |
testcase_231 | AC | 14 ms
39,668 KB |
testcase_232 | WA | - |
testcase_233 | WA | - |
testcase_234 | AC | 12 ms
39,636 KB |
testcase_235 | AC | 13 ms
39,688 KB |
testcase_236 | AC | 11 ms
39,632 KB |
testcase_237 | WA | - |
testcase_238 | AC | 13 ms
39,664 KB |
testcase_239 | AC | 14 ms
39,544 KB |
testcase_240 | AC | 13 ms
39,616 KB |
testcase_241 | AC | 13 ms
39,676 KB |
testcase_242 | AC | 13 ms
39,660 KB |
testcase_243 | AC | 12 ms
39,612 KB |
testcase_244 | AC | 14 ms
39,624 KB |
testcase_245 | AC | 13 ms
39,664 KB |
testcase_246 | AC | 12 ms
39,604 KB |
testcase_247 | AC | 12 ms
39,652 KB |
testcase_248 | AC | 13 ms
39,708 KB |
testcase_249 | AC | 13 ms
39,564 KB |
testcase_250 | AC | 14 ms
39,700 KB |
testcase_251 | AC | 14 ms
39,656 KB |
testcase_252 | AC | 14 ms
39,616 KB |
testcase_253 | AC | 13 ms
39,664 KB |
testcase_254 | AC | 13 ms
39,660 KB |
testcase_255 | AC | 12 ms
39,660 KB |
testcase_256 | AC | 13 ms
39,648 KB |
testcase_257 | AC | 13 ms
39,704 KB |
testcase_258 | AC | 11 ms
39,708 KB |
testcase_259 | AC | 13 ms
39,648 KB |
testcase_260 | AC | 13 ms
39,624 KB |
testcase_261 | AC | 13 ms
39,824 KB |
testcase_262 | AC | 14 ms
39,644 KB |
testcase_263 | AC | 13 ms
39,620 KB |
testcase_264 | AC | 13 ms
39,672 KB |
testcase_265 | AC | 12 ms
39,632 KB |
testcase_266 | AC | 12 ms
39,620 KB |
testcase_267 | AC | 14 ms
39,712 KB |
testcase_268 | AC | 12 ms
39,760 KB |
testcase_269 | WA | - |
testcase_270 | WA | - |
testcase_271 | WA | - |
testcase_272 | WA | - |
testcase_273 | WA | - |
testcase_274 | AC | 11 ms
39,660 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 | 13 ms
39,640 KB |
testcase_288 | AC | 12 ms
39,708 KB |
testcase_289 | WA | - |
testcase_290 | WA | - |
testcase_291 | AC | 12 ms
39,624 KB |
testcase_292 | AC | 13 ms
39,688 KB |
testcase_293 | AC | 13 ms
39,716 KB |
testcase_294 | WA | - |
testcase_295 | AC | 12 ms
39,656 KB |
testcase_296 | AC | 13 ms
39,664 KB |
testcase_297 | AC | 14 ms
39,676 KB |
testcase_298 | AC | 13 ms
39,648 KB |
testcase_299 | AC | 13 ms
39,624 KB |
testcase_300 | AC | 13 ms
39,652 KB |
testcase_301 | AC | 14 ms
39,652 KB |
testcase_302 | AC | 13 ms
39,708 KB |
testcase_303 | AC | 13 ms
39,648 KB |
testcase_304 | AC | 15 ms
39,632 KB |
testcase_305 | AC | 14 ms
39,704 KB |
testcase_306 | AC | 13 ms
39,652 KB |
testcase_307 | AC | 12 ms
39,632 KB |
testcase_308 | AC | 13 ms
39,648 KB |
testcase_309 | AC | 14 ms
39,616 KB |
testcase_310 | AC | 12 ms
39,616 KB |
testcase_311 | AC | 14 ms
39,696 KB |
testcase_312 | AC | 13 ms
39,632 KB |
testcase_313 | AC | 13 ms
39,688 KB |
testcase_314 | AC | 13 ms
39,688 KB |
testcase_315 | AC | 13 ms
39,688 KB |
testcase_316 | AC | 13 ms
39,656 KB |
testcase_317 | AC | 14 ms
39,620 KB |
testcase_318 | AC | 13 ms
39,660 KB |
testcase_319 | AC | 14 ms
39,648 KB |
testcase_320 | AC | 13 ms
39,688 KB |
testcase_321 | AC | 11 ms
39,672 KB |
testcase_322 | AC | 13 ms
39,736 KB |
testcase_323 | AC | 13 ms
39,620 KB |
testcase_324 | AC | 13 ms
39,764 KB |
testcase_325 | AC | 13 ms
39,644 KB |
testcase_326 | WA | - |
testcase_327 | WA | - |
testcase_328 | WA | - |
testcase_329 | WA | - |
testcase_330 | WA | - |
testcase_331 | AC | 13 ms
39,660 KB |
testcase_332 | WA | - |
testcase_333 | WA | - |
testcase_334 | WA | - |
testcase_335 | WA | - |
testcase_336 | WA | - |
testcase_337 | WA | - |
testcase_338 | WA | - |
testcase_339 | WA | - |
testcase_340 | WA | - |
testcase_341 | WA | - |
testcase_342 | WA | - |
testcase_343 | WA | - |
testcase_344 | AC | 13 ms
39,620 KB |
testcase_345 | AC | 11 ms
39,676 KB |
testcase_346 | AC | 13 ms
39,620 KB |
testcase_347 | AC | 14 ms
39,640 KB |
testcase_348 | AC | 11 ms
39,684 KB |
testcase_349 | AC | 13 ms
39,692 KB |
testcase_350 | AC | 11 ms
39,640 KB |
testcase_351 | AC | 14 ms
39,640 KB |
testcase_352 | AC | 12 ms
39,716 KB |
testcase_353 | WA | - |
testcase_354 | AC | 13 ms
39,728 KB |
testcase_355 | WA | - |
testcase_356 | AC | 12 ms
39,648 KB |
testcase_357 | AC | 12 ms
39,624 KB |
testcase_358 | AC | 12 ms
39,684 KB |
testcase_359 | WA | - |
testcase_360 | AC | 13 ms
39,684 KB |
testcase_361 | WA | - |
testcase_362 | AC | 13 ms
39,640 KB |
testcase_363 | WA | - |
testcase_364 | AC | 12 ms
39,636 KB |
testcase_365 | AC | 13 ms
39,680 KB |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef long long ll; #define pb(x) push_back(x) #define mp(a, b) make_pair(a, b) #define all(x) x.begin(), x.end() #define rall(x) x.rbegin(), x.rend() #define lscan(x) scanf("%I64d", &x) #define lprint(x) printf("%I64d", x) #define rep(i, n) for (ll i = 0; i < (n); i++) #define rep2(i, n) for (ll i = n - 1; i >= 0; i--) template <class T> using rque = priority_queue<T, vector<T>, greater<T>>; const ll mod = 998244353; template <class T> bool chmin(T &a, const T &b) { if (b < a) { a = b; return 1; } return 0; } template <class T> bool chmax(T &a, const T &b) { if (b > a) { a = b; return 1; } return 0; } ll gcd(ll a, ll b) { ll c = a % b; while (c != 0) { a = b; b = c; c = a % b; } return b; } long long extGCD(long long a, long long b, long long &x, long long &y) { if (b == 0) { x = 1; y = 0; return a; } long long d = extGCD(b, a % b, y, x); y -= a / b * x; return d; } struct UnionFind { vector<ll> data; UnionFind(int sz) { data.assign(sz, -1); } bool unite(int x, int y) { x = find(x), y = find(y); if (x == y) return (false); if (data[x] > data[y]) swap(x, y); data[x] += data[y]; data[y] = x; return (true); } int find(int k) { if (data[k] < 0) return (k); return (data[k] = find(data[k])); } ll size(int k) { return (-data[find(k)]); } }; ll M = 1000000007; vector<ll> fac(2000011, 0); //n!(mod M) vector<ll> ifac(2000011); //k!^{M-2} (mod M) ll mpow(ll x, ll n) { ll ans = 1; while (n != 0) { if (n & 1) ans = ans * x % M; x = x * x % M; n = n >> 1; } return ans; } ll mpow2(ll x, ll n, ll mod) { ll ans = 1; while (n != 0) { if (n & 1) ans = ans * x % mod; x = x * x % mod; n = n >> 1; } return ans; } void setcomb() { fac[0] = 1; ifac[0] = 1; for (ll i = 0; i < 2000010; i++) { fac[i + 1] = fac[i] * (i + 1) % M; // n!(mod M) } ifac[2000010] = mpow(fac[2000010], M - 2); for (ll i = 2000010; i > 0; i--) { ifac[i - 1] = ifac[i] * i % M; } } ll comb(ll a, ll b) { if(fac[0] == 0) setcomb(); if (a == 0 && b == 0) return 1; if (a < b || a < 0) return 0; ll tmp = ifac[a - b] * ifac[b] % M; return tmp * fac[a] % M; } ll perm(ll a, ll b) { if (a == 0 && b == 0) return 1; if (a < b || a < 0) return 0; return fac[a] * ifac[a - b] % M; } long long modinv(long long a) { long long b = M, u = 1, v = 0; while (b) { long long t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= M; if (u < 0) u += M; return u; } ll modinv2(ll a, ll mod) { ll b = mod, u = 1, v = 0; while (b) { ll t = a / b; a -= t * b; swap(a, b); u -= t * v; swap(u, v); } u %= mod; if (u < 0) u += mod; return u; } template <int mod> struct ModInt { int x; ModInt() : x(0) {} ModInt(int64_t y) : x(y >= 0 ? y % mod : (mod - (-y) % mod) % mod) {} ModInt &operator+=(const ModInt &p) { if ((x += p.x) >= mod) x -= mod; return *this; } ModInt &operator-=(const ModInt &p) { if ((x += mod - p.x) >= mod) x -= mod; return *this; } ModInt &operator*=(const ModInt &p) { x = (int)(1LL * x * p.x % mod); return *this; } ModInt &operator/=(const ModInt &p) { *this *= p.inverse(); return *this; } ModInt operator-() const { return ModInt(-x); } ModInt operator+(const ModInt &p) const { return ModInt(*this) += p; } ModInt operator-(const ModInt &p) const { return ModInt(*this) -= p; } ModInt operator*(const ModInt &p) const { return ModInt(*this) *= p; } ModInt operator/(const ModInt &p) const { return ModInt(*this) /= p; } bool operator==(const ModInt &p) const { return x == p.x; } bool operator!=(const ModInt &p) const { return x != p.x; } ModInt inverse() const { int a = x, b = mod, u = 1, v = 0, t; while (b > 0) { t = a / b; swap(a -= t * b, b); swap(u -= t * v, v); } return ModInt(u); } ModInt pow(int64_t n) const { ModInt ret(1), mul(x); while (n > 0) { if (n & 1) ret *= mul; mul *= mul; n >>= 1; } return ret; } friend ostream &operator<<(ostream &os, const ModInt &p) { return os << p.x; } friend istream &operator>>(istream &is, ModInt &a) { int64_t t; is >> t; a = ModInt<mod>(t); return (is); } static int get_mod() { return mod; } }; using mint = ModInt<mod>; typedef vector<vector<mint>> Matrix; Matrix mul(Matrix a, Matrix b) { assert(a[0].size() == b.size()); int i, j, k; int n = a.size(), m = b[0].size(), l = a[0].size(); Matrix c(n, vector<mint>(m)); for (i = 0; i < n; i++) for (k = 0; k < l; k++) for (j = 0; j < m; j++) c[i][j] += a[i][k] * b[k][j]; return c; } Matrix mat_pow(Matrix x, ll n) { ll k = x.size(); Matrix ans(k, vector<mint>(k, 0)); for (int i = 0; i < k; i++) ans[i][i] = 1; while (n != 0) { if (n & 1) ans = mul(ans, x); x = mul(x, x); n = n >> 1; } return ans; } vector<ll> li[222222]; pair<ll,pair<ll,ll>> dfs(ll now, ll par, ll lim){ ll cost = 0, dis = 0, rem = -1; if(now == 0){ for(auto &e: li[now]){ if(e != par){ auto res = dfs(e, now, lim); cost += res.first; chmax(dis, res.second.first); chmax(rem, res.second.second); } } if(rem < dis) cost++; return mp(cost, mp(0, 0)); } else{ for(auto &e: li[now]){ if(e != par){ auto res = dfs(e, now, lim); cost += res.first; chmax(dis, res.second.first); chmax(rem, res.second.second); } } if(rem >= dis) dis = 0; else{ if(dis == lim){ cost++; dis = 0; rem = lim; } else dis++; } rem--; return mp(cost, mp(dis, rem)); } } int main(){ ll y, n, d; cin >> y >> n >> d; ll flag; if(y%4 != 0) flag = 0; else if(y%100 == 0 && y%400 != 0) flag = 0; else flag = 1; ll ma, mi; if(flag) ma = min(n, 366 - d); else ma = min(n, 365 - d); mi = max(0ll, n - d); cout << mi << " " << ma << endl; }