제출 #1144938

#제출 시각아이디문제언어결과실행 시간메모리
1144938KasymKTrampoline (info1cup20_trampoline)C++20
23 / 100
2092 ms122696 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;} int main(){ int r, c, n; scanf("%d%d%d", &r, &c, &n); vector<vector<bool>> gr(r+1, vector<bool> (c+1, false)), vis(r+1, vector<bool> (c+1, false)); auto is=[&](int a, int b) -> bool { return (a>=1 and a<=r and b>=1 and b<=c and !vis[a][b]); }; while(n--){ int a, b; scanf("%d%d", &a, &b); gr[a][b]=1; } int q; scanf("%d", &q); while(q--){ vis.assign(r+1, vector<bool> (c+1, false)); int x, y, x1, y1; scanf("%d%d%d%d", &x, &y, &x1, &y1); queue<pii> q; q.push({x, y}); while(!q.empty()){ if(vis[x1][y1]) break; pii P=q.front(); q.pop(); if(gr[P.ff][P.ss]){ if(is(P.ff+1, P.ss)) q.push({P.ff+1, P.ss}), vis[P.ff+1][P.ss]=1; if(is(P.ff, P.ss+1)) q.push({P.ff, P.ss+1}), vis[P.ff][P.ss+1]=1; continue; } if(is(P.ff, P.ss+1)) q.push({P.ff, P.ss+1}), vis[P.ff][P.ss+1]=1; } puts(vis[x1][y1]?"Yes":"No"); } return 0; }

컴파일 시 표준 에러 (stderr) 메시지

trampoline.cpp: In function 'int main()':
trampoline.cpp:18:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   18 |     scanf("%d%d%d", &r, &c, &n);
      |     ~~~~~^~~~~~~~~~~~~~~~~~~~~~
trampoline.cpp:25:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   25 |         scanf("%d%d", &a, &b);
      |         ~~~~~^~~~~~~~~~~~~~~~
trampoline.cpp:29:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   29 |     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...