# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
1193401 | 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=1e8+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... |