Submission #59621703


Source Code Expand

Copy
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define no cout<<"NO\n"
#define yes cout<<"YES\n"
const ll MOD = 1e9 + 7;
const ll N = 2e5 + 5;
#define MAX_SIZE 300001
void solve(){
ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
ll cnt = 0, ans = 0, sum=0;
string ug, ug1, ug2;
char useg = 'a';
bool bval = 1, bval1 = 0;
cin >> q;
multiset<long long> plants;
ll timePassed = 0;
while (q--) {
ll type;
cin >> type;
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#include <bits/stdc++.h>
#define ll long long
using namespace std;
#define no cout<<"NO\n"
#define yes cout<<"YES\n"
const ll MOD = 1e9 + 7;
const ll N = 2e5 + 5;
#define MAX_SIZE 300001
void solve(){
    ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
    ll cnt = 0, ans = 0, sum=0;
    string ug, ug1, ug2;
    char useg = 'a';
    bool bval = 1, bval1 = 0;
    cin >> q;
    
    multiset<long long> plants;
    ll timePassed = 0;
    while (q--) {
        ll type;
        cin >> type;
        if (type == 1)
            plants.insert(timePassed);
        else if (type == 2) {
            ll t;
            cin >> t;
            timePassed += t;
            
        } 
        else if (type == 3) {
            ll h;
            cin >> h;
            h = timePassed-h;
            auto it = plants.upper_bound(h);
            ll count = distance(plants.begin(), it);
            cout << count << '\n';
            plants.erase(plants.begin(), it);
        }
    }
}
int main() {
    ios_base::sync_with_stdio(false); cin.tie(0); cout.tie(0);
    ll testCase=1;
    //cin >> testCase;
    while(testCase--) {
        solve();
    }
}

Submission Info

Submission Time
Task D - Home Garden
User erdene_1231
Language C++ 20 (gcc 12.2)
Score 400
Code Size 1209 Byte
Status AC
Exec Time 17 ms
Memory 3648 KB

Compile Error

Main.cpp: In function ‘void solve()’:
Main.cpp:10:8: warning: unused variable ‘a’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |        ^
Main.cpp:10:11: warning: unused variable ‘b’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |           ^
Main.cpp:10:14: warning: unused variable ‘c’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |              ^
Main.cpp:10:17: warning: unused variable ‘d’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                 ^
Main.cpp:10:20: warning: unused variable ‘e’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                    ^
Main.cpp:10:23: warning: unused variable ‘g’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                       ^
Main.cpp:10:26: warning: unused variable ‘h’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                          ^
Main.cpp:10:29: warning: unused variable ‘x’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                             ^
Main.cpp:10:32: warning: unused variable ‘y’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                ^
Main.cpp:10:35: warning: unused variable ‘z’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                   ^
Main.cpp:10:38: warning: unused variable ‘r’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                      ^
Main.cpp:10:41: warning: unused variable ‘l’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                         ^
Main.cpp:10:44: warning: unused variable ‘t’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                            ^
Main.cpp:10:47: warning: unused variable ‘o’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                               ^
Main.cpp:10:50: warning: unused variable ‘p’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                                  ^
Main.cpp:10:53: warning: unused variable ‘i’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                                     ^
Main.cpp:10:56: warning: unused variable ‘j’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                                        ^
Main.cpp:10:59: warning: unused variable ‘k’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                                           ^
Main.cpp:10:63: warning: unused variable ‘w’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                                               ^
Main.cpp:10:65: warning: unused variable ‘s’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                                                 ^
Main.cpp:10:67: warning: unused variable ‘u’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                                                   ^
Main.cpp:10:69: warning: unused variable ‘v’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                                                     ^
Main.cpp:10:71: warning: unused variable ‘n’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                                                       ^
Main.cpp:10:73: warning: unused variable ‘m’ [-Wunused-variable]
   10 |     ll a, b, c, d, e, g, h, x, y, z, r, l, t, o, p, i, j, k,q,w,s,u,v,n,m;
      |                                                                         ^
Main.cpp:11:8: warning: unused variable ‘cnt’ [-Wunused-variable]
   11 |     ll cnt = 0, ans = 0, sum=0;
      |        ^~~
Main.cpp:11:17: warning: unused variable ‘ans’ [-Wunused-variable]
   11 |     ll cnt = 0, ans = 0, sum=0;
      |                 ^~~
Main.cpp:11:26: warning: unused variable ‘sum’ [-Wunused-variable]
   11 |     ll cnt = 0, ans = 0, sum=0;
      |                          ^~~
Main.cpp:13:10: warning: unused variable ‘useg’ [-Wunused-variable]
   13 |     char useg = 'a';
      |          ^~~~
Main.cpp:14:10: warning: unused variable ‘bval’ [-Wunused-variable]
   14 |     bool bval = 1, bval1 = 0;
      |          ^~~~
Main.cpp:14:20: warning: unused variable ‘bval1’ [-Wunused-variable]
   14 |     bool bval = 1, bval1 = 0;
      |                    ^~~~~

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 400 / 400
Status
AC × 2
AC × 30
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt
All 00_sample_00.txt, 00_sample_01.txt, 01_random_00.txt, 01_random_01.txt, 01_random_02.txt, 01_random_03.txt, 01_random_04.txt, 01_random_05.txt, 01_random_06.txt, 01_random_07.txt, 01_random_08.txt, 01_random_09.txt, 01_random_10.txt, 01_random_11.txt, 01_random_12.txt, 01_random_13.txt, 01_random_14.txt, 01_random_15.txt, 01_random_16.txt, 01_random_17.txt, 01_random_18.txt, 01_random_19.txt, 01_random_20.txt, 01_random_21.txt, 01_random_22.txt, 01_random_23.txt, 01_random_24.txt, 02_hand_00.txt, 02_hand_01.txt, 02_hand_02.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 1 ms 3512 KB
00_sample_01.txt AC 1 ms 3564 KB
01_random_00.txt AC 11 ms 3448 KB
01_random_01.txt AC 15 ms 3448 KB
01_random_02.txt AC 13 ms 3392 KB
01_random_03.txt AC 11 ms 3500 KB
01_random_04.txt AC 5 ms 3444 KB
01_random_05.txt AC 13 ms 3388 KB
01_random_06.txt AC 4 ms 3444 KB
01_random_07.txt AC 9 ms 3420 KB
01_random_08.txt AC 4 ms 3524 KB
01_random_09.txt AC 1 ms 3528 KB
01_random_10.txt AC 8 ms 3516 KB
01_random_11.txt AC 4 ms 3528 KB
01_random_12.txt AC 15 ms 3440 KB
01_random_13.txt AC 15 ms 3524 KB
01_random_14.txt AC 5 ms 3524 KB
01_random_15.txt AC 6 ms 3372 KB
01_random_16.txt AC 4 ms 3524 KB
01_random_17.txt AC 13 ms 3536 KB
01_random_18.txt AC 7 ms 3520 KB
01_random_19.txt AC 14 ms 3648 KB
01_random_20.txt AC 15 ms 3588 KB
01_random_21.txt AC 15 ms 3600 KB
01_random_22.txt AC 16 ms 3420 KB
01_random_23.txt AC 16 ms 3424 KB
01_random_24.txt AC 17 ms 3456 KB
02_hand_00.txt AC 17 ms 3436 KB
02_hand_01.txt AC 16 ms 3504 KB
02_hand_02.txt AC 17 ms 3436 KB


2025-03-05 (Wed)
18:12:02 +00:00