# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
948133 | nguyennh | Monkey and Apple-trees (IZhO12_apple) | C++14 | 2072 ms | 4448 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>
#define el '\n'
using namespace std ;
mt19937 rd(chrono::steady_clock::now().time_since_epoch().count());
const int MN = 1e6 + 10;
int32_t main (){
ios_base::sync_with_stdio(0);
cin.tie(0);
int m;
cin >> m;
vector<int> a(MN , 0);
int64_t last = 0;
for ( int i = 1 ; i <= m ; i++ ){
int64_t type , l , r;
cin >> type >> l >> r;
l += last;
r += last;
if (type == 1){
int ans = 0;
for ( int i = l ; i <= r ; i++ ) ans += a[i];
last = ans;
cout << last << el;
}
else {
for ( int i = l ; i <= r ; i++ ) a[i] = 1;
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |