70662023-12-29 11:00:26MagyarKendeSZLGEgykorúak (75 pont)cpp17Wrong answer 60/7528ms3364 KiB
#include <bits/stdc++.h>

#define speed cin.tie(0); ios::sync_with_stdio(0)

using namespace std;

const int N_lengthS[13] = {
    0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

const int S_lengthS[13] = {
    0, 31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31
};

int days(int e, int h, int n) {
    for (int i = 1; i < e; i++) {
        n += (i % 4 ? 365 : 366);
    }
    if (e % 4) {
        for (int i = 1; i <= h; i++) {
            n += N_lengthS[i];
        }
    } else {
        for (int i = 1; i <= h; i++) {
            n += S_lengthS[i];
        }
    }
    return n;
}

int main() {
    speed;

    int M, E, H, N, D, result = 0;
    cin >> M >> E >> H >> N;
    
    D = days(E, H, N);

    for (int i = 0; i < M; i++) {
        int FE, FH, FN, FD;
        cin >> FE >> FH >> FN;

        result += (abs(days(FE, FH, FN) - D) <= 365);
    }

    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base60/75
1Accepted0/03ms1892 KiB
2Accepted0/028ms2124 KiB
3Accepted5/53ms2476 KiB
4Accepted5/53ms2568 KiB
5Accepted5/53ms2892 KiB
6Accepted5/53ms2852 KiB
7Accepted5/52ms2680 KiB
8Accepted5/53ms2812 KiB
9Accepted5/53ms2808 KiB
10Wrong answer0/58ms2876 KiB
11Accepted5/58ms3004 KiB
12Accepted5/59ms3236 KiB
13Wrong answer0/513ms3240 KiB
14Accepted5/514ms3220 KiB
15Accepted5/517ms3324 KiB
16Wrong answer0/519ms3244 KiB
17Accepted5/526ms3364 KiB