#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;
}
# |
결과 |
실행 시간 |
메모리 |
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 |
- |