Submission #521215

# Submission time Handle Problem Language Result Execution time Memory
521215 2022-02-01T08:24:49 Z Baytoro Trampoline (info1cup20_trampoline) C++17
0 / 100
104 ms 10076 KB
#include <bits/stdc++.h>
using namespace std;
#define Baytoro_MayrambekovOrz void solve()
#define ios ios::sync_with_stdio(false); cin.tie(NULL);
#define pb push_back
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define fr first
#define sc second
#define int long long
#define endl '\n'
#define yes cout<<"YES\n";
#define no cout<<"NO\n";
void fopn(string name){
	freopen((name+".in").c_str(),"r",stdin);
	freopen((name+".out").c_str(),"w",stdout);
}
int binpow(int a,int n){
	if(n==0)
		return 1;
	if(n%2==1)
		return binpow(a, n-1)*a;
	else{
		int b=binpow(a, n/2);
		return b*b;
	}
}
vector<int> vec[100005];
int a,b,c,n,m,r,i,j,k,x,y,cnt=0,sum=0,res=0;
Baytoro_MayrambekovOrz{
	cin>>r>>c>>n;
	for(i=0;i<n;i++){
		cin>>a>>b;
		vec[a].pb(b);
	}
	for(i=0;i<100000;i++)
		vec[i].pb(1e9);
	//sort(all(vec));
	int q;
	cin>>q;
	while(q--){
		int x1,x2,y1,y2;
		cin>>y1>>x1>>y2>>x2;
		if(x2<x1 || y2<y1){
			cout<<"NO\n";
			continue;
		}
		if(y1==y2){
			cout<<"YES\n";
			continue;
		}
		int posy=y1,posx=x1;
		while(posy!=y2){
			posx=*lower_bound(all(vec[posy]),posx);
			//cout<<posx<<endl;
			if(posx>x2){
				cout<<"NO\n";
				break;
			}
			posy++;
		}
		if(posx<=x2 && posy==y2)
		cout<<"YES\n";
		
	}
}
main(){
	//ios;
	int T=1;
	//cin>>T;
	while(T--){
		solve();
	}
}


Compilation message

trampoline.cpp:67:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   67 | main(){
      | ^~~~
trampoline.cpp: In function 'void fopn(std::string)':
trampoline.cpp:15:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   15 |  freopen((name+".in").c_str(),"r",stdin);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
trampoline.cpp:16:9: warning: ignoring return value of 'FILE* freopen(const char*, const char*, FILE*)' declared with attribute 'warn_unused_result' [-Wunused-result]
   16 |  freopen((name+".out").c_str(),"w",stdout);
      |  ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 10 ms 5828 KB expected YES, found NO [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 104 ms 10076 KB expected YES, found NO [3rd token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 5196 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 5 ms 5160 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 6 ms 5216 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -