Submission #76086389


Source Code Expand

#include <bits/stdc++.h>
using namespace std;
 
int main() {
    int n,q,a,b,L,R,max = 0;
    cin >> n >> q;
    L = n + 1; R = -1;
    int sw = 0;
    vector<int> blocks(n+1);

    for(int i = 0; i < q; i ++){
        cin >> a >> b;        
        if(a == 1){
            if(blocks.at(b) == 0) sw ++;
            blocks.at(b) ++;
            if(L > b) L = b;
            if(R < b) R = b;
            if(blocks.at(b) > max) max = blocks.at(b);
            if(sw == n) {
                L = n + 1; R = -1;
                for(int j = 1; j <= n; j ++) {
                    blocks.at(j) --;
                    if(blocks.at(j) == 0) sw --;
                    if(blocks.at(j) > 0 && L > j) L = j;
                    if(blocks.at(j) > 0 && R < j) R = j;                   
                }
                max --;
            }

        }
        else if(a == 2 && max >= b) {
            int sum = 0;
            for(int j = L; j <= R; j ++){
                if(blocks.at(j) >= b) sum ++;
            }
            cout << sum << endl;
        }
        else cout << 0 << endl;
    }
}

Submission Info

Submission Time
Task C - Drop Blocks
User Kisaragi2000
Language C++23 (GCC 15.2.0)
Score 0
Code Size 1125 Byte
Status TLE
Exec Time > 2000 ms
Memory 4504 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 0 / 300
Status
AC × 1
AC × 45
TLE × 5
Set Name Test Cases
Sample example_00.txt
All example_00.txt, hand_00.txt, hand_01.txt, hand_02.txt, hand_03.txt, hand_04.txt, hand_05.txt, hand_06.txt, hand_07.txt, hand_08.txt, hand_09.txt, hand_10.txt, hand_11.txt, hand_12.txt, hand_13.txt, hand_14.txt, hand_15.txt, hand_16.txt, hand_17.txt, hand_18.txt, hand_19.txt, hand_20.txt, hand_21.txt, hand_22.txt, hand_23.txt, hand_24.txt, hand_25.txt, hand_26.txt, hand_27.txt, hand_28.txt, random_00.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, random_17.txt, random_18.txt, random_19.txt
Case Name Status Exec Time Memory
example_00.txt AC 1 ms 3528 KiB
hand_00.txt AC 72 ms 4452 KiB
hand_01.txt AC 72 ms 4504 KiB
hand_02.txt AC 173 ms 3612 KiB
hand_03.txt AC 1707 ms 3612 KiB
hand_04.txt TLE > 2000 ms 3864 KiB
hand_05.txt AC 669 ms 3608 KiB
hand_06.txt AC 914 ms 3452 KiB
hand_07.txt AC 46 ms 3468 KiB
hand_08.txt AC 151 ms 3492 KiB
hand_09.txt AC 100 ms 3484 KiB
hand_10.txt AC 103 ms 3480 KiB
hand_11.txt AC 62 ms 3652 KiB
hand_12.txt AC 62 ms 3608 KiB
hand_13.txt AC 168 ms 3628 KiB
hand_14.txt AC 120 ms 3688 KiB
hand_15.txt AC 328 ms 3624 KiB
hand_16.txt AC 1 ms 3492 KiB
hand_17.txt AC 179 ms 4308 KiB
hand_18.txt AC 46 ms 3492 KiB
hand_19.txt AC 46 ms 3560 KiB
hand_20.txt AC 46 ms 3492 KiB
hand_21.txt TLE > 2000 ms 4400 KiB
hand_22.txt AC 72 ms 4376 KiB
hand_23.txt TLE > 2000 ms 4376 KiB
hand_24.txt TLE > 2000 ms 4336 KiB
hand_25.txt AC 2 ms 4272 KiB
hand_26.txt AC 1 ms 4376 KiB
hand_27.txt TLE > 2000 ms 4468 KiB
hand_28.txt AC 90 ms 3356 KiB
random_00.txt AC 103 ms 3512 KiB
random_01.txt AC 122 ms 3468 KiB
random_02.txt AC 149 ms 3324 KiB
random_03.txt AC 1982 ms 3452 KiB
random_04.txt AC 1737 ms 3612 KiB
random_05.txt AC 120 ms 3492 KiB
random_06.txt AC 79 ms 3480 KiB
random_07.txt AC 142 ms 3448 KiB
random_08.txt AC 699 ms 3608 KiB
random_09.txt AC 1788 ms 3624 KiB
random_10.txt AC 127 ms 3492 KiB
random_11.txt AC 83 ms 3500 KiB
random_12.txt AC 152 ms 3496 KiB
random_13.txt AC 614 ms 3480 KiB
random_14.txt AC 1474 ms 3612 KiB
random_15.txt AC 72 ms 3492 KiB
random_16.txt AC 147 ms 3492 KiB
random_17.txt AC 108 ms 3512 KiB
random_18.txt AC 114 ms 3656 KiB
random_19.txt AC 1777 ms 3452 KiB