Submission #1144930

#TimeUsernameProblemLanguageResultExecution timeMemory
1144930KasymKTrampoline (info1cup20_trampoline)C++20
0 / 100
2103 ms282612 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 = 2505; bool vis[N][N]; int main(){ int r, c, n; scanf("%d%d%d", &r, &c, &n); auto is=[&](int a, int b) -> bool { return (a>=1 and a<=r and b>=1 and b<=c); }; while(n--){ int a, b; scanf("%d%d", &a, &b); vis[a][b]=1; } int q; scanf("%d", &q); while(q--){ int x, y, x1, y1; scanf("%d%d%d%d", &x, &y, &x1, &y1); queue<pii> q; q.push({x, y}); bool did=0; while(!q.empty()){ pii P=q.front(); q.pop(); if(P.ff==x1 and P.ss==y1){ did=1; break; } if(vis[P.ff][P.ss]){ if(is(P.ff+1, P.ss)) q.push({P.ff+1, P.ss}); if(is(P.ff, P.ss+1)) q.push({P.ff, P.ss+1}); continue; } if(is(P.ff, P.ss+1)) q.push({P.ff, P.ss+1}); } puts(did?"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:30:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   30 |     scanf("%d", &q);
      |     ~~~~~^~~~~~~~~~
trampoline.cpp:33:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   33 |         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...