Submission #253999

# Submission time Handle Problem Language Result Execution time Memory
253999 2020-07-29T08:51:35 Z test2 Monkey and Apple-trees (IZhO12_apple) C++14
0 / 100
1 ms 512 KB
#include <bits/stdc++.h>

using namespace std;


const int N = 1e5 + 7 ; 
int t, a, b, c;
int rip[N] ; 

int main()
{
        ios_base::sync_with_stdio(0);
        cin.tie(0);
        //freopen("in.in", "r", stdin);

        cin >> t;
        int C = 0 ; 
        while (t--)
        {
                int a, b, c;
                cin >> a >> b >> c;
                b+= C ; 
                c+= C ;
                if(a == 1){
                        int ans = 0;  
                        for(int j = b ; j<= c ;j++){
                                ans+= rip[j] ;
                        }
                        C = ans ; 
                        cout<< ans <<"\n" ; 
                }else{
                        for(int j = b ;j<= c;j ++){
                                rip[j] = 1 ; 
                        }
                }

        }

        return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 384 KB Output is correct
2 Correct 0 ms 384 KB Output is correct
3 Correct 0 ms 384 KB Output is correct
4 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
5 Halted 0 ms 0 KB -