# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1193400 | ezzzay | Monkey and Apple-trees (IZhO12_apple) | C++20 | 0 ms | 328 KiB |
#include<bits/stdc++.h>
using namespace std;
#define ff first
#define ss second
#define int long long
#define pb push_back
const int N=3e5+5;
int a[N];
vector<int>ans;
signed main(){
int q;
cin>>q;
int c=0;
while(q--){
int t;
cin>>t;
int s=0;
if(t==2){
int l,r;
cin>>l>>r;
l+=c,r+=c;
for(int i=l;i<=r;i++)a[i]++;
}
else{
int l,r;
cin>>l>>r;
l+=c;r+=c;
for(int i=l;i<=r;i++){
s+=a[i];
}
c=s;
ans.pb(s);
}
}
for(auto a:ans)cout<<a<<endl;
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |