174362025-07-16 12:56:26sarminEgykorúak (75 pont)cpp17Accepted 75/754ms508 KiB
#include <bits/stdc++.h>
using namespace std;

int main() {

    ios_base::sync_with_stdio(false);
    cin.tie(0);

    int n; cin >> n;
    array<int, 3> d; cin >> d[0] >> d[1] >> d[2];
    vector<int> months = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
    int ans = 0;
    for (int i = 0; i < n; i++) {
        array<int, 3> e, o; cin >> e[0] >> e[1] >> e[2];
        o = d;
        if (e > o) swap(e, o);
        int start = (e[0]-1)*365+e[2], end = (o[0]-1)*365+o[2];
        for (int j = 1; j <= e[1]; j++) start += months[j];
        for (int j = 1; j <= o[1]; j++) end += months[j];
        int diff = end-start;
        for (int j = (e[1] >= 3 ? e[0]+1 : e[0]); j <= (o[1] >= 3 ? o[0] : o[0]-1); j++) if (j%4 == 0) diff++;
        if (diff <= 365) ans++;
    }
    cout << ans << "\n";
	
    return 0;
}
SubtaskSumTestVerdictTimeMemory
base75/75
1Accepted0/01ms508 KiB
2Accepted0/04ms432 KiB
3Accepted5/51ms316 KiB
4Accepted5/51ms316 KiB
5Accepted5/51ms348 KiB
6Accepted5/51ms316 KiB
7Accepted5/51ms316 KiB
8Accepted5/51ms316 KiB
9Accepted5/51ms500 KiB
10Accepted5/52ms316 KiB
11Accepted5/52ms316 KiB
12Accepted5/52ms316 KiB
13Accepted5/52ms392 KiB
14Accepted5/53ms388 KiB
15Accepted5/53ms316 KiB
16Accepted5/53ms316 KiB
17Accepted5/54ms316 KiB