結果

問題 No.8083 12歳
ユーザー torisasami4torisasami4
提出日時 2021-04-01 21:31:16
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
RE  
実行時間 -
コード長 6,349 bytes
コンパイル時間 2,283 ms
コンパイル使用メモリ 182,436 KB
実行使用メモリ 40,128 KB
最終ジャッジ日時 2024-12-21 05:50:46
合計ジャッジ時間 39,745 ms
ジャッジサーバーID
(参考情報)
judge5 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 14 ms
39,796 KB
testcase_01 AC 16 ms
39,616 KB
testcase_02 AC 16 ms
39,708 KB
testcase_03 AC 16 ms
39,648 KB
testcase_04 AC 16 ms
39,660 KB
testcase_05 AC 15 ms
39,696 KB
testcase_06 AC 15 ms
39,616 KB
testcase_07 AC 17 ms
39,620 KB
testcase_08 AC 17 ms
39,628 KB
testcase_09 AC 15 ms
39,712 KB
testcase_10 AC 15 ms
39,712 KB
testcase_11 AC 15 ms
39,700 KB
testcase_12 AC 16 ms
39,672 KB
testcase_13 AC 16 ms
39,624 KB
testcase_14 AC 15 ms
39,696 KB
testcase_15 AC 15 ms
39,788 KB
testcase_16 AC 14 ms
39,696 KB
testcase_17 AC 16 ms
39,736 KB
testcase_18 AC 16 ms
39,668 KB
testcase_19 AC 14 ms
39,652 KB
testcase_20 AC 15 ms
39,712 KB
testcase_21 AC 14 ms
39,672 KB
testcase_22 AC 15 ms
39,644 KB
testcase_23 AC 16 ms
39,832 KB
testcase_24 AC 15 ms
39,740 KB
testcase_25 AC 15 ms
39,792 KB
testcase_26 AC 15 ms
39,612 KB
testcase_27 AC 16 ms
39,736 KB
testcase_28 AC 16 ms
39,804 KB
testcase_29 AC 16 ms
39,644 KB
testcase_30 AC 15 ms
39,692 KB
testcase_31 AC 17 ms
39,788 KB
testcase_32 AC 15 ms
39,684 KB
testcase_33 AC 16 ms
39,656 KB
testcase_34 AC 15 ms
39,620 KB
testcase_35 AC 15 ms
39,660 KB
testcase_36 AC 14 ms
39,700 KB
testcase_37 AC 15 ms
39,676 KB
testcase_38 AC 15 ms
39,748 KB
testcase_39 AC 15 ms
39,656 KB
testcase_40 AC 15 ms
39,772 KB
testcase_41 AC 16 ms
39,672 KB
testcase_42 AC 15 ms
39,712 KB
testcase_43 AC 15 ms
39,676 KB
testcase_44 AC 15 ms
39,660 KB
testcase_45 AC 15 ms
39,816 KB
testcase_46 AC 18 ms
39,620 KB
testcase_47 AC 16 ms
39,724 KB
testcase_48 AC 15 ms
39,648 KB
testcase_49 AC 16 ms
39,636 KB
testcase_50 AC 14 ms
39,640 KB
testcase_51 AC 15 ms
39,808 KB
testcase_52 AC 15 ms
39,772 KB
testcase_53 AC 16 ms
39,672 KB
testcase_54 AC 14 ms
39,724 KB
testcase_55 AC 16 ms
39,780 KB
testcase_56 AC 14 ms
39,700 KB
testcase_57 AC 15 ms
39,616 KB
testcase_58 AC 15 ms
39,564 KB
testcase_59 RE -
testcase_60 RE -
testcase_61 RE -
testcase_62 RE -
testcase_63 RE -
testcase_64 RE -
testcase_65 RE -
testcase_66 RE -
testcase_67 RE -
testcase_68 RE -
testcase_69 RE -
testcase_70 RE -
testcase_71 RE -
testcase_72 RE -
testcase_73 RE -
testcase_74 RE -
testcase_75 RE -
testcase_76 RE -
testcase_77 RE -
testcase_78 RE -
testcase_79 RE -
testcase_80 RE -
testcase_81 RE -
testcase_82 RE -
testcase_83 RE -
testcase_84 RE -
testcase_85 RE -
testcase_86 RE -
testcase_87 RE -
testcase_88 RE -
testcase_89 RE -
testcase_90 RE -
testcase_91 RE -
testcase_92 RE -
testcase_93 RE -
testcase_94 RE -
testcase_95 RE -
testcase_96 RE -
testcase_97 RE -
testcase_98 RE -
testcase_99 RE -
testcase_100 RE -
testcase_101 RE -
testcase_102 RE -
testcase_103 RE -
testcase_104 RE -
testcase_105 RE -
testcase_106 RE -
testcase_107 RE -
testcase_108 RE -
testcase_109 RE -
testcase_110 RE -
testcase_111 RE -
testcase_112 RE -
testcase_113 RE -
testcase_114 RE -
testcase_115 RE -
testcase_116 AC 16 ms
39,656 KB
testcase_117 AC 14 ms
39,808 KB
testcase_118 AC 16 ms
39,844 KB
testcase_119 AC 16 ms
39,676 KB
testcase_120 AC 15 ms
39,736 KB
testcase_121 AC 16 ms
39,656 KB
testcase_122 AC 14 ms
39,828 KB
testcase_123 AC 16 ms
39,712 KB
testcase_124 AC 15 ms
39,672 KB
testcase_125 AC 14 ms
39,612 KB
testcase_126 AC 15 ms
39,712 KB
testcase_127 AC 15 ms
39,700 KB
testcase_128 AC 15 ms
39,636 KB
testcase_129 AC 15 ms
39,664 KB
testcase_130 AC 16 ms
39,712 KB
testcase_131 AC 15 ms
39,748 KB
testcase_132 AC 16 ms
39,708 KB
testcase_133 AC 17 ms
39,624 KB
testcase_134 AC 16 ms
39,680 KB
testcase_135 AC 15 ms
39,672 KB
testcase_136 AC 16 ms
39,720 KB
testcase_137 AC 17 ms
39,652 KB
testcase_138 AC 15 ms
39,800 KB
testcase_139 AC 16 ms
39,648 KB
testcase_140 AC 16 ms
39,824 KB
testcase_141 AC 15 ms
39,648 KB
testcase_142 AC 15 ms
39,620 KB
testcase_143 AC 14 ms
39,680 KB
testcase_144 AC 15 ms
39,652 KB
testcase_145 AC 15 ms
39,628 KB
testcase_146 AC 15 ms
39,756 KB
testcase_147 AC 14 ms
39,724 KB
testcase_148 AC 15 ms
39,648 KB
testcase_149 AC 17 ms
39,652 KB
testcase_150 AC 16 ms
39,728 KB
testcase_151 AC 15 ms
39,680 KB
testcase_152 AC 16 ms
39,628 KB
testcase_153 AC 15 ms
39,688 KB
testcase_154 AC 15 ms
39,648 KB
testcase_155 AC 16 ms
39,748 KB
testcase_156 AC 16 ms
39,660 KB
testcase_157 AC 14 ms
39,676 KB
testcase_158 AC 14 ms
39,740 KB
testcase_159 AC 15 ms
39,716 KB
testcase_160 AC 15 ms
39,780 KB
testcase_161 AC 16 ms
39,636 KB
testcase_162 AC 16 ms
39,812 KB
testcase_163 AC 16 ms
39,664 KB
testcase_164 AC 16 ms
39,620 KB
testcase_165 AC 15 ms
39,620 KB
testcase_166 AC 17 ms
39,664 KB
testcase_167 AC 14 ms
39,680 KB
testcase_168 AC 16 ms
39,784 KB
testcase_169 AC 16 ms
39,720 KB
testcase_170 AC 16 ms
39,640 KB
testcase_171 AC 16 ms
39,644 KB
testcase_172 AC 15 ms
39,620 KB
testcase_173 AC 15 ms
39,668 KB
testcase_174 AC 16 ms
39,628 KB
testcase_175 AC 16 ms
39,732 KB
testcase_176 AC 16 ms
39,672 KB
testcase_177 AC 17 ms
39,620 KB
testcase_178 AC 16 ms
39,616 KB
testcase_179 AC 17 ms
39,660 KB
testcase_180 AC 16 ms
39,716 KB
testcase_181 AC 17 ms
39,788 KB
testcase_182 AC 17 ms
39,660 KB
testcase_183 AC 16 ms
39,804 KB
testcase_184 AC 18 ms
39,700 KB
testcase_185 AC 15 ms
39,696 KB
testcase_186 AC 16 ms
39,660 KB
testcase_187 AC 17 ms
39,620 KB
testcase_188 AC 16 ms
39,716 KB
testcase_189 AC 16 ms
39,696 KB
testcase_190 AC 16 ms
39,692 KB
testcase_191 AC 17 ms
39,656 KB
testcase_192 AC 16 ms
39,752 KB
testcase_193 AC 16 ms
39,704 KB
testcase_194 AC 15 ms
39,680 KB
testcase_195 AC 15 ms
39,620 KB
testcase_196 AC 17 ms
39,664 KB
testcase_197 AC 17 ms
39,740 KB
testcase_198 AC 14 ms
39,628 KB
testcase_199 AC 15 ms
39,816 KB
testcase_200 AC 15 ms
39,724 KB
testcase_201 AC 17 ms
39,680 KB
testcase_202 AC 16 ms
39,672 KB
testcase_203 AC 16 ms
39,616 KB
testcase_204 AC 15 ms
39,700 KB
testcase_205 AC 16 ms
39,684 KB
testcase_206 AC 14 ms
39,796 KB
testcase_207 AC 14 ms
39,820 KB
testcase_208 AC 15 ms
39,692 KB
testcase_209 AC 16 ms
39,756 KB
testcase_210 AC 14 ms
39,704 KB
testcase_211 AC 16 ms
39,648 KB
testcase_212 AC 14 ms
39,628 KB
testcase_213 AC 16 ms
39,704 KB
testcase_214 AC 16 ms
39,788 KB
testcase_215 AC 13 ms
39,632 KB
testcase_216 AC 14 ms
39,688 KB
testcase_217 AC 15 ms
39,672 KB
testcase_218 AC 15 ms
39,648 KB
testcase_219 AC 16 ms
39,632 KB
testcase_220 AC 15 ms
39,672 KB
testcase_221 AC 15 ms
39,696 KB
testcase_222 AC 16 ms
39,644 KB
testcase_223 AC 16 ms
39,800 KB
testcase_224 AC 15 ms
39,656 KB
testcase_225 AC 15 ms
39,712 KB
testcase_226 AC 14 ms
39,624 KB
testcase_227 AC 16 ms
39,676 KB
testcase_228 AC 14 ms
39,680 KB
testcase_229 AC 17 ms
39,688 KB
testcase_230 RE -
testcase_231 RE -
testcase_232 RE -
testcase_233 RE -
testcase_234 RE -
testcase_235 RE -
testcase_236 RE -
testcase_237 RE -
testcase_238 RE -
testcase_239 RE -
testcase_240 RE -
testcase_241 RE -
testcase_242 RE -
testcase_243 RE -
testcase_244 RE -
testcase_245 RE -
testcase_246 RE -
testcase_247 RE -
testcase_248 RE -
testcase_249 RE -
testcase_250 RE -
testcase_251 RE -
testcase_252 RE -
testcase_253 RE -
testcase_254 RE -
testcase_255 RE -
testcase_256 RE -
testcase_257 RE -
testcase_258 RE -
testcase_259 RE -
testcase_260 RE -
testcase_261 RE -
testcase_262 RE -
testcase_263 RE -
testcase_264 RE -
testcase_265 RE -
testcase_266 RE -
testcase_267 RE -
testcase_268 RE -
testcase_269 RE -
testcase_270 RE -
testcase_271 RE -
testcase_272 RE -
testcase_273 RE -
testcase_274 RE -
testcase_275 RE -
testcase_276 RE -
testcase_277 RE -
testcase_278 RE -
testcase_279 RE -
testcase_280 RE -
testcase_281 RE -
testcase_282 RE -
testcase_283 RE -
testcase_284 RE -
testcase_285 RE -
testcase_286 RE -
testcase_287 AC 15 ms
39,620 KB
testcase_288 AC 17 ms
39,620 KB
testcase_289 AC 16 ms
39,704 KB
testcase_290 AC 16 ms
39,644 KB
testcase_291 AC 15 ms
39,716 KB
testcase_292 AC 19 ms
39,644 KB
testcase_293 AC 15 ms
39,680 KB
testcase_294 AC 16 ms
39,628 KB
testcase_295 AC 15 ms
39,684 KB
testcase_296 AC 16 ms
39,632 KB
testcase_297 AC 16 ms
39,800 KB
testcase_298 AC 15 ms
39,660 KB
testcase_299 AC 15 ms
39,632 KB
testcase_300 AC 17 ms
39,636 KB
testcase_301 AC 15 ms
39,664 KB
testcase_302 AC 16 ms
39,628 KB
testcase_303 AC 15 ms
39,652 KB
testcase_304 AC 16 ms
39,720 KB
testcase_305 AC 16 ms
39,688 KB
testcase_306 AC 15 ms
39,672 KB
testcase_307 AC 16 ms
39,788 KB
testcase_308 AC 17 ms
39,648 KB
testcase_309 AC 15 ms
39,624 KB
testcase_310 AC 15 ms
39,652 KB
testcase_311 AC 17 ms
39,636 KB
testcase_312 AC 15 ms
39,780 KB
testcase_313 AC 16 ms
39,616 KB
testcase_314 AC 16 ms
39,724 KB
testcase_315 AC 15 ms
39,740 KB
testcase_316 AC 17 ms
39,624 KB
testcase_317 AC 18 ms
39,720 KB
testcase_318 AC 16 ms
39,724 KB
testcase_319 AC 15 ms
39,780 KB
testcase_320 AC 15 ms
39,624 KB
testcase_321 AC 16 ms
39,740 KB
testcase_322 AC 16 ms
39,812 KB
testcase_323 AC 16 ms
39,628 KB
testcase_324 AC 14 ms
39,656 KB
testcase_325 AC 16 ms
39,700 KB
testcase_326 AC 16 ms
39,692 KB
testcase_327 AC 16 ms
39,740 KB
testcase_328 AC 15 ms
39,620 KB
testcase_329 AC 15 ms
39,668 KB
testcase_330 AC 16 ms
39,620 KB
testcase_331 AC 16 ms
39,740 KB
testcase_332 AC 16 ms
39,660 KB
testcase_333 AC 15 ms
39,768 KB
testcase_334 AC 15 ms
39,708 KB
testcase_335 AC 15 ms
39,640 KB
testcase_336 AC 15 ms
39,760 KB
testcase_337 AC 16 ms
39,644 KB
testcase_338 AC 16 ms
39,688 KB
testcase_339 AC 16 ms
39,660 KB
testcase_340 AC 17 ms
39,712 KB
testcase_341 AC 15 ms
39,832 KB
testcase_342 AC 15 ms
39,628 KB
testcase_343 AC 15 ms
39,624 KB
testcase_344 AC 16 ms
39,636 KB
testcase_345 AC 16 ms
39,644 KB
testcase_346 RE -
testcase_347 AC 15 ms
39,780 KB
testcase_348 RE -
testcase_349 AC 15 ms
39,736 KB
testcase_350 AC 15 ms
39,644 KB
testcase_351 AC 15 ms
39,688 KB
testcase_352 AC 17 ms
39,668 KB
testcase_353 AC 16 ms
39,728 KB
testcase_354 AC 16 ms
39,700 KB
testcase_355 AC 15 ms
39,688 KB
testcase_356 AC 16 ms
39,648 KB
testcase_357 AC 14 ms
39,712 KB
testcase_358 AC 13 ms
39,792 KB
testcase_359 AC 14 ms
39,632 KB
testcase_360 RE -
testcase_361 RE -
testcase_362 AC 16 ms
39,624 KB
testcase_363 AC 16 ms
39,692 KB
testcase_364 AC 17 ms
39,736 KB
testcase_365 AC 15 ms
39,716 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#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 flag1, flag2;
	if((y+1)%4 != 0)
		flag1 = 0;
	else if((y+1)%100 == 0 && (y+1)%400 != 0)
		flag1 = 0;
	else
		flag1 = 1;
	if((y-12)%4 != 0)
		flag2 = 0;
	else if((y-12)%100 == 0 && (y-12)%400 != 0)
		flag2 = 0;
	else
		flag2 = 1;
	ll ma, mi;
	if(flag1 && flag2){
		ma = min(n, 366 - d);
		mi = max(0ll, n - d);
	}
	else if(flag1 && !flag2){
		assert(0);
		ll t = d;
		if(t > 332)
			t--;
		ma = min(n, 365 - t);
		mi = max(0ll, n - t);
	}
	else if(!flag1 && flag2){
		ll t = d;
		if(t > 333)
			t++;
		ma = min(n, 366 - t);
		mi = max(0ll, n - t);
	}
	else{
		ma = min(n, 365 - d);
		mi = max(0ll, n - d);
	}
	cout << mi << " " << ma << endl;
}
0