Submission #71315528


Source Code Expand

#include <bits/stdc++.h>
#define nn '\n'
typedef long long ll;
using namespace std;

void solve1() {
    int w, b;
    cin >> w >> b;
    cout << 1000*w/b + 1;
}

void solve2() {
    int m,n;
    cin >> n >> m;
    map<int, pair<int, int>> data;
    for (int i=0; i<n; ++i) {
        int el1, el2; 
        cin >> el1 >> el2;
        data[el1].first += el2;
        data[el1].second++;
    }
    cout << fixed << setprecision(10);
    for (auto& [s, m]: data) {
        cout << (double) m.first / m.second << nn;
    }
}

void solve() {
    int T;
    cin >> T;
    while (T--) {
        int N, H;
        cin >> N >> H;
        vector<int> t(N), l(N), u(N);
        for (int i = 0; i < N; i++) {
            cin >> t[i] >> l[i] >> u[i];
        }
        int prev_t = 0;
        int low = H, high = H;
        bool possible = true;
        for (int i = 0; i < N; i++) {
            int dt = t[i] - prev_t;
            low = max(1, low - dt);
            high = high + dt;
            low = max(low, l[i]);
            high = min(high, u[i]);     
            if (low > high) {
                possible = false;
                break;
            }
            prev_t = t[i];
        }
        cout << (possible ? "Yes" : "No") << "\n";
    }
}


int main() {
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    solve();
    return 0;
}

Submission Info

Submission Time
Task C - Flapping Takahashi
User ikam
Language C++23 (GCC 15.2.0)
Score 300
Code Size 1405 Byte
Status AC
Exec Time 23 ms
Memory 4624 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 1
AC × 29
Set Name Test Cases
Sample 00_sample_00.txt
All 00_sample_00.txt, 01_small_00.txt, 01_small_01.txt, 01_small_02.txt, 01_small_03.txt, 01_small_04.txt, 01_small_05.txt, 01_small_06.txt, 01_small_07.txt, 02_random_00.txt, 02_random_01.txt, 02_random_02.txt, 02_random_03.txt, 02_random_04.txt, 02_random_05.txt, 02_random_06.txt, 02_random_07.txt, 02_random_08.txt, 02_random_09.txt, 02_random_10.txt, 02_random_11.txt, 02_random_12.txt, 02_random_13.txt, 02_random_14.txt, 02_random_15.txt, 02_random_16.txt, 02_random_17.txt, 02_random_18.txt, 02_random_19.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3604 KiB
01_small_00.txt AC 23 ms 3564 KiB
01_small_01.txt AC 18 ms 3484 KiB
01_small_02.txt AC 16 ms 3536 KiB
01_small_03.txt AC 15 ms 3608 KiB
01_small_04.txt AC 13 ms 3648 KiB
01_small_05.txt AC 12 ms 3536 KiB
01_small_06.txt AC 12 ms 3564 KiB
01_small_07.txt AC 12 ms 3536 KiB
02_random_00.txt AC 10 ms 4368 KiB
02_random_01.txt AC 12 ms 4560 KiB
02_random_02.txt AC 12 ms 4548 KiB
02_random_03.txt AC 11 ms 4416 KiB
02_random_04.txt AC 12 ms 4488 KiB
02_random_05.txt AC 12 ms 4548 KiB
02_random_06.txt AC 9 ms 4312 KiB
02_random_07.txt AC 12 ms 4540 KiB
02_random_08.txt AC 12 ms 4560 KiB
02_random_09.txt AC 7 ms 3904 KiB
02_random_10.txt AC 12 ms 4432 KiB
02_random_11.txt AC 12 ms 4568 KiB
02_random_12.txt AC 12 ms 4432 KiB
02_random_13.txt AC 12 ms 4624 KiB
02_random_14.txt AC 12 ms 4568 KiB
02_random_15.txt AC 12 ms 4548 KiB
02_random_16.txt AC 12 ms 4536 KiB
02_random_17.txt AC 12 ms 4560 KiB
02_random_18.txt AC 12 ms 4544 KiB
02_random_19.txt AC 12 ms 4560 KiB