Submission #543606

# Submission time Handle Problem Language Result Execution time Memory
543606 2022-03-31T01:03:15 Z 089487 Monkey and Apple-trees (IZhO12_apple) C++14
0 / 100
1547 ms 1548 KB
#pragma GCC optimzize("Ofast,no-stack-protector")
#include<bits/stdc++.h>
#define int long long
#define quick ios::sync_with_stdio(0);cin.tie(0);
#define rep(x,a,b) for(int x=a;x<=b;x++)
#define repd(x,a,b) for(int x=a;x>=n;x--)
#define lowbit(x) (x&-x)
#define sz(x) (int)(x.size())
#define F first
#define S second
#define all(x) x.begin(),x.end()
#define mp make_pair
#define eb emplace_back
using namespace std;
typedef pair<int,int> pii;
void debug(){
    cout<<"\n";
}
template <class T,class ... U >
void debug(T a, U ... b){
    cout<<a<<" ",debug(b...);
}
const int N=1e6+7;
const int INF=1e18;
bool f[N];
signed main(){
    quick
    int m;
    cin>>m;
    int c=0;
    while(m--){
    	int r,x,y;
    	cin>>r>>x>>y;
    	x+=c,y+=c;
    	if(r==1){
    		c=0;
    		for(int i=x;i<=y;i++){
    			c+=(f[i]);
			}
			cout<<c<<"\n";
		}
		else{
			for(int i=x;i<=y;i++) f[i]=true;
		}
	}
    return 0;
}

Compilation message

apple.cpp:1: warning: ignoring '#pragma GCC optimzize' [-Wunknown-pragmas]
    1 | #pragma GCC optimzize("Ofast,no-stack-protector")
      |
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1125 ms 1196 KB Output is correct
5 Correct 1547 ms 1548 KB Output is correct
6 Correct 1323 ms 1368 KB Output is correct
7 Correct 1514 ms 1468 KB Output is correct
8 Runtime error 2 ms 468 KB Execution killed with signal 11
9 Halted 0 ms 0 KB -