70652023-12-29 10:59:25MagyarKendeSZLGEgykorúak (75 pont)cpp17Wrong answer 40/7528ms3868 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
base40/75
1Accepted0/03ms1928 KiB
2Accepted0/028ms2088 KiB
3Accepted5/53ms2296 KiB
4Accepted5/53ms2512 KiB
5Accepted5/53ms2724 KiB
6Accepted5/53ms2804 KiB
7Accepted5/53ms3028 KiB
8Accepted5/53ms3020 KiB
9Accepted5/53ms3140 KiB
10Wrong answer0/58ms3380 KiB
11Wrong answer0/58ms3448 KiB
12Wrong answer0/59ms3440 KiB
13Wrong answer0/513ms3672 KiB
14Wrong answer0/514ms3652 KiB
15Accepted5/517ms3752 KiB
16Wrong answer0/519ms3760 KiB
17Wrong answer0/526ms3868 KiB