# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
254000 | test2 | Monkey and Apple-trees (IZhO12_apple) | C++14 | 2074 ms | 4216 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
const int N = 1e6 + 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 |
---|---|---|---|---|
Fetching results... |