結果

問題 No.3402 [Cherry Anniversary 5] Beyond Zelkova, the 5th year vista seen through the bloom of a cherry bloosom
コンテスト
ユーザー shobonvip
提出日時 2025-12-12 22:09:01
言語 C++17
(gcc 13.3.0 + boost 1.89.0)
結果
AC  
実行時間 10 ms / 2,000 ms
コード長 2,600 bytes
記録
記録タグの例:
初AC ショートコード 純ショートコード 純主流ショートコード 最速実行時間
コンパイル時間 4,239 ms
コンパイル使用メモリ 253,816 KB
実行使用メモリ 7,848 KB
最終ジャッジ日時 2025-12-12 22:09:07
合計ジャッジ時間 5,232 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 1
other AC * 24
権限があれば一括ダウンロードができます

ソースコード

diff #
raw source code

/**
	author:  shobonvip
	created: 2025.12.12 21:59:48
**/

#include<bits/stdc++.h>
using namespace std;

//* ATCODER
#include<atcoder/all>
using namespace atcoder;
typedef modint998244353 mint;
//*/

/* BOOST MULTIPRECISION
#include<boost/multiprecision/cpp_int.hpp>
using namespace boost::multiprecision;
//*/

typedef long long ll;

#define rep(i, s, n) for (int i = (int)(s); i < (int)(n); i++)
#define rrep(i, s, n) for (int i = (int)(n)-1; i >= (int)(s); i--)
#define all(v) v.begin(), v.end()

template <typename T> bool chmin(T &a, const T &b) {
	if (a <= b) return false;
	a = b;
	return true;
}

template <typename T> bool chmax(T &a, const T &b) {
	if (a >= b) return false;
	a = b;
	return true;
}

template <typename T> T max(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmax(ret, a[i]);
	return ret;
}

template <typename T> T min(vector<T> &a){
	assert(!a.empty());
	T ret = a[0];
	for (int i=0; i<(int)a.size(); i++) chmin(ret, a[i]);
	return ret;
}

template <typename T> T sum(vector<T> &a){
	T ret = 0;
	for (int i=0; i<(int)a.size(); i++) ret += a[i];
	return ret;
}

vector<int> days_of_month_raw = {
	0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

bool is_leap(int year) {
	if (year % 4 == 0) {
		if (year % 100 == 0) {
			if (year % 400 == 0) {
				return true;
			}
			return false;
		}
		return true;
	}
	return false;
}

int days_of_month(int year, int month) {
	assert(1 <= month && month <= 12);
	if (month == 2) {
		if (is_leap(year)) {
			return 29;
		} else {
			return 28;
		}
	} else {
		return days_of_month_raw[month];
	}
}

const int mx_year = 2026;
vector<int> rui_days_of_year(mx_year + 1);

struct dates {
	int year, month, day;
};

int date_to_num(dates s) {
	int ret = rui_days_of_year[s.year];
	for (int i=1; i<s.month; i++) {
		ret += days_of_month(s.year, i);
	}
	ret += s.day-1;
	return ret;
}

int main(){
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);

	rep(i,0,mx_year) {
		rui_days_of_year[i + 1] += rui_days_of_year[i];
		if (is_leap(i)) {
			rui_days_of_year[i + 1] += 366;
		} else {
			rui_days_of_year[i + 1] += 365;
		}
	}

	int ys, ms, ds;
	int ye, me, de;

	cin >> ys >> ms >> ds;
	cin >> ye >> me >> de;
	int kessei = date_to_num(dates{ys, ms, ds});
	int kaimei = date_to_num(dates{ye, me, de}) + 1;


	int q; cin >> q;
	while (q--) {
		int y, m, d;
		cin >> y >> m >> d;
		int now = date_to_num(dates{y, m, d}) + 1;
		if (kaimei - kessei > now - kaimei) {
			cout << "Less\n";
		} else if (kaimei - kessei < now - kaimei) {
			cout << "More\n";
		} else {
			cout << "Same\n";
		}
	}
}

0