Submission #1027667

# Submission time Handle Problem Language Result Execution time Memory
1027667 2024-07-19T08:47:03 Z vjudge1 Trampoline (info1cup20_trampoline) C++17
11 / 100
481 ms 27680 KB
#include<bits/stdc++.h>
using namespace std;
#define lalala ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define ll long long
#define int long long int
//#define endl '\n'
#define N 600100
#define M 32
#define big 2147483647 
#define bigg 9223372036854775807 
#define pb push_back
#define p push
#define ins insert
#define f first
#define s second

vector<int> adj[N];
void solve(){
	int r,c,n;cin>>r>>c>>n;
	vector<pair<int,int>> v;
	vector<int> yedek,comprez;
	for(int i=0;i<n;i++){
		int a,b;cin>>a>>b;
		v.pb({b,a});
		yedek.pb(a);yedek.pb(b);
	}
	sort(v.begin(),v.end());
	sort(yedek.begin(),yedek.end());
	comprez.pb(yedek[0]);
	for(int i=1;i<n*2;i++){
		if(yedek[i]!=yedek[i-1])comprez.pb(yedek[i]);
	}
	for(auto u:v){
		int yer=u.s;
		int kim=lower_bound(comprez.begin(),comprez.end(),yer)-comprez.begin();
		adj[kim].clear();
	}
	for(auto u:v){
		int yer=u.s;
		int kim=lower_bound(comprez.begin(),comprez.end(),yer)-comprez.begin();
		adj[kim].pb(u.f);
	}
	/*for(auto u:v){
		int yer=u.s;
		int kim=upper_bound(comprez.begin(),comprez.end(),yer)-comprez.begin();
		kim--;
		cout<<kim<<": ";
		for(auto u:adj[kim])cout<<u<<" ";
		cout<<endl; 
	}*/
	int q;cin>>q;
	while(q--){
		int x,y,a,b;cin>>x>>y>>a>>b;
		int kim=(lower_bound(comprez.begin(),comprez.end(),x)-comprez.begin());
		if(kim==comprez.size()||comprez[kim]!=x){
			cout<<"No"<<endl;
			continue;
		}
		int yer=(lower_bound(adj[kim].begin(),adj[kim].end(),y)-adj[kim].begin());
		if(yer==adj[kim].size()){
			cout<<"No"<<endl;
			continue;
		}
		int yey=adj[kim][yer];
		if(yey>b)cout<<"No"<<endl;
		else cout<<"Yes"<<endl;


	}


}


signed main(){
	lalala;
	solve();
	
}

Compilation message

trampoline.cpp: In function 'void solve()':
trampoline.cpp:55:9: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   55 |   if(kim==comprez.size()||comprez[kim]!=x){
      |      ~~~^~~~~~~~~~~~~~~~
trampoline.cpp:60:9: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   60 |   if(yer==adj[kim].size()){
      |      ~~~^~~~~~~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Incorrect 8 ms 15060 KB expected NO, found YES [2nd token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 104 ms 23708 KB expected NO, found YES [1st token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 396 ms 26288 KB 200000 token(s): yes count is 110486, no count is 89514
2 Correct 414 ms 26468 KB 200000 token(s): yes count is 114664, no count is 85336
3 Correct 397 ms 25380 KB 200000 token(s): yes count is 86232, no count is 113768
4 Correct 412 ms 25500 KB 200000 token(s): yes count is 94603, no count is 105397
5 Correct 440 ms 25256 KB 200000 token(s): yes count is 94148, no count is 105852
6 Correct 450 ms 27624 KB 200000 token(s): yes count is 97163, no count is 102837
# Verdict Execution time Memory Grader output
1 Incorrect 15 ms 14684 KB expected NO, found YES [17th token]
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 481 ms 27680 KB expected NO, found YES [23rd token]
2 Halted 0 ms 0 KB -