70642023-12-29 10:56:26MagyarKendeSZLGEgykorúak (75 pont)cpp17Wrong answer 40/7517ms3580 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;

        if (abs(E - FE) > 1) continue;
        
        if (E == FE) {
            result++;
            continue;
        }

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

    cout << result;
}
SubtaskSumTestVerdictTimeMemory
base40/75
1Accepted0/03ms2172 KiB
2Accepted0/017ms2328 KiB
3Accepted5/53ms2432 KiB
4Accepted5/53ms2520 KiB
5Accepted5/53ms2652 KiB
6Accepted5/53ms2732 KiB
7Accepted5/53ms2636 KiB
8Accepted5/53ms2768 KiB
9Accepted5/53ms2932 KiB
10Wrong answer0/54ms3164 KiB
11Wrong answer0/56ms3236 KiB
12Wrong answer0/57ms3240 KiB
13Wrong answer0/58ms3368 KiB
14Wrong answer0/59ms3448 KiB
15Accepted5/510ms3448 KiB
16Wrong answer0/512ms3452 KiB
17Wrong answer0/514ms3580 KiB