Submission #535940

# Submission time Handle Problem Language Result Execution time Memory
535940 2022-03-11T22:40:57 Z inksamurai Osumnjičeni (COCI21_osumnjiceni) C++17
0 / 110
46 ms 9052 KB
#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for(int i=0;i<n;i++)
#define rng(i,x,n) for(int i=x;i<n;i++)
#define per(i,n) for(int i=n-1;i>=0;i--)
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define vec(...) vector<__VA_ARGS__>
#define _3HspL4A ios::sync_with_stdio(0),cin.tie(0)
typedef long long ll;
using pii=pair<int,int>;
using vi=vec(int);
void print(){cout<<"\n";}
template<class T,class...E>
void print(const T&v,const E&...u){cout<<v<<' ',print(u...);}
// e

using vp=vec(pii);

signed main(){
_3HspL4A;
	int n;
	cin>>n;
	vp a(n);
	rep(i,n){
		cin>>a[i].fi>>a[i].se;
	}
	int q;
	cin>>q;
	rep(_,q){
		int s,t;
		cin>>s>>t;
		s-=1;
		vi cnt(n+1);
		rng(j,s,t){
			cnt[a[j].fi]+=1;
			cnt[a[j].se+1]-=1;
		}
		int v=0;
		rng(j,1,n){
			cnt[j]+=cnt[j-1];
			v=max(v,cnt[j]);
		}
		print(v);
	}
//	
	return 0;
}
# Verdict Execution time Memory Grader output
1 Runtime error 45 ms 8716 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 584 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 2 ms 584 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 46 ms 9052 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 45 ms 8716 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -