Submission #1027829

#TimeUsernameProblemLanguageResultExecution timeMemory
1027829vjudge1Trampoline (info1cup20_trampoline)C++17
43 / 100
2105 ms185016 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,avx2,fma") #include <bits/stdc++.h> using namespace std; #define int long long #define OYY LLONG_MAX #define mod 998244353 #define faster ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL); #define FOR for(int i=1;i<=n;i++) #define mid (start+end)/2 #define lim 2000005 #define fi first #define se second int r,c,n,timer; vector<int> v[lim]; vector<pair<int,int>> vy; int xm[lim],ym[lim]; int tut[lim]; map<int,int> mp; set<int> st; inline void solve(int q){ FOR{ st.insert(xm[i]); } for(auto x:st){ mp[x]=++timer; tut[timer]=x; } FOR{ v[mp[xm[i]]].push_back(ym[i]); } for(int i=1;i<=timer;i++){ sort(v[i].begin(),v[i].end()); } cin>>q; while(q--){ int x1,y1,x2,y2; cin>>x1>>y1>>x2>>y2; if(mp.find(x1)==mp.end()){ cout<<"No"<<'\n'; continue; } int tut=lower_bound(v[mp[x1]].begin(),v[mp[x1]].end(),y1)-v[mp[x1]].begin(); if(tut>=v[mp[x1]].size()){ cout<<"No"<<'\n'; continue; } if(v[mp[x1]][tut]<=y2){ cout<<"Yes"<<'\n'; } else cout<<"No"<<'\n'; } } int32_t main(){ faster cin>>r>>c>>n; FOR{ cin>>xm[i]>>ym[i]; vy.push_back({xm[i],ym[i]}); } sort(vy.begin(),vy.end()); int q;cin>>q; if(q<=4000){ while(q--){ int x1,y1,x2,y2;cin>>x1>>y1>>x2>>y2; bool stop=0; for(int i=0;i<vy.size();i++){ //cout<<x1<<" "<<y1<<endl; if(vy[i].fi<x1){ continue; } if(vy[i].fi==x1 && y1<=vy[i].se){ x1++; y1=vy[i].se; } if(x1==x2 && y1<=y2){ stop=1; break; } } if(stop){ cout<<"Yes"<<'\n'; } else cout<<"No"<<'\n'; } } else{ solve(q); } return 0; }

Compilation message (stderr)

trampoline.cpp: In function 'void solve(long long int)':
trampoline.cpp:58: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]
   58 |   if(tut>=v[mp[x1]].size()){
      |      ~~~^~~~~~~~~~~~~~~~~~
trampoline.cpp: In function 'int32_t main()':
trampoline.cpp:85:16: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   85 |   for(int i=0;i<vy.size();i++){
      |               ~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...