Submission #1144957

#TimeUsernameProblemLanguageResultExecution timeMemory
1144957KasymKTrampoline (info1cup20_trampoline)C++20
23 / 100
317 ms13212 KiB
#include "bits/stdc++.h" using namespace std; #define ff first #define ss second #define all(v) v.begin(), v.end() #define ll long long #define pb push_back #define pii pair<int, int> #define pli pair<ll, int> #define pll pair<ll, ll> #define tr(i, c) for(auto i = c.begin(); i != c.end(); ++i) #define wr puts("----------------") template<class T>bool umin(T& a,T b){if(a>b){a=b;return 1;}return 0;} template<class T>bool umax(T& a,T b){if(a<b){a=b;return 1;}return 0;} const int N = 2e5+5; vector<int> adj[N]; int main(){ int r, c, n; scanf("%d%d%d", &r, &c, &n); vector<int> v; vector<pii> A; map<int, int> mp; for(int i = 0; i < n; ++i){ int a, b; scanf("%d%d", &a, &b); A.pb({a, b}); if(!mp.count(a)) mp[a]++, v.pb(a); } int op=-1; sort(all(v)); tr(it, v) mp[*it]=++op; // tr(it, A) // printf("%d %d\n", *it); tr(it, A) adj[mp[it->ff]].pb(it->ss); for(auto i : mp) sort(all(adj[i.ff])); int q; scanf("%d", &q); while(q--){ int x, y, x1, y1; scanf("%d%d%d%d", &x, &y, &x1, &y1); if(x>x1 or y>y1){ puts("No"); continue; } while(x<x1){ if(!mp.count(x)) break; if(adj[mp[x]].back()<y) break; int id=lower_bound(all(adj[mp[x]]), y)-adj[mp[x]].begin(); y=adj[mp[x]][id], x++; } puts(x==x1 and y<=y1?"Yes":"No"); } return 0; }

Compilation message (stderr)

trampoline.cpp: In function 'int main()':
trampoline.cpp:20:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   20 |     scanf("%d%d%d", &r, &c, &n);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
trampoline.cpp:26:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   26 |         scanf("%d%d", &a, &b);
      |         ~~~~~^~~~~~~~~~~~~~~~
trampoline.cpp:42:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   42 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
trampoline.cpp:45:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   45 |         scanf("%d%d%d%d", &x, &y, &x1, &y1);
      |         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
#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...