71242023-12-31 11:48:39IgnácEgykorúak (75 pont)cpp17Accepted 75/759ms3484 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {
	struct date2 {
		vector<int> hh = {0, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334};
		int ev, honap, nap;
		int napokban;
		void set_date (int e, int h, int n) {
			ev = e;
			honap = h;
			nap = n;
			napokban = ev * 365 + hh[h] + nap + (ev) / 4;
			if (ev % 4 == 0 && honap <= 2) napokban--;
		}

		int operator- (date2 other) {
			return napokban - other.napokban;
		}
	};

	int n, E, H, N;
	cin >> n >> E >> H >> N;
	date2 Peti;
	Peti.set_date(E, H, N);
	int db = 0;
	while (n--) {
		int TE, TH, TN;
		cin >> TE >> TH >> TN;
		date2 a;
		a.set_date(TE, TH, TN);
		if (abs(Peti - a) <= 365) db++;
	}

	cout << db;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/03ms1808 KiB
2Accepted0/09ms2084 KiB
3Accepted5/53ms2220 KiB
4Accepted5/53ms2264 KiB
5Accepted5/53ms2268 KiB
6Accepted5/53ms2336 KiB
7Accepted5/53ms2340 KiB
8Accepted5/53ms2464 KiB
9Accepted5/53ms2552 KiB
10Accepted5/54ms2548 KiB
11Accepted5/54ms2828 KiB
12Accepted5/54ms2772 KiB
13Accepted5/56ms2832 KiB
14Accepted5/56ms2900 KiB
15Accepted5/57ms3028 KiB
16Accepted5/58ms3268 KiB
17Accepted5/59ms3484 KiB