Submission #1145128

#TimeUsernameProblemLanguageResultExecution timeMemory
1145128arafatenokTrampoline (info1cup20_trampoline)C++17
0 / 100
873 ms1114112 KiB
#include <bits/stdc++.h> #pragma GCC optimize("Ofast,no-stack-protector,unroll-loops,fast-math,O3") #pragma GCC optimize("Ofast") #pragma GCC target("avx,avx2,fma") #pragma GCC optimization("unroll-loops") #pragma ("reroll") #define skip continue; #define gold ios_base::sync_with_stdio(false);cin.tie(NULL); #define xa "\n" #define int long long #define all(a) a.begin(), a.end() #define pb push_back #define F first #define S second using namespace std; const int mod = 1e9 + 7; const int N = 2e3 + 507; const int MAX = 1e9; const int inf = 1e18; int gcd(int a, int b) { if (b == 0) return a; else if(a == 0) return b; else return gcd(b, a % b); } int lcm(int a, int b) { return a / gcd(a, b) * b; } char x[N][N]; vector < pair < int, int > > ans[N][N]; int r, c, n; void f(int x1, int y1, int x2, int y2){ if(x2 > r || y2 > c) return; ans[x1][y1].pb({x2, y2}); if(x[x2][y2] == 'b') f(x1, y1, x2, y2 + 1); else { f(x1, y1, x2, y2 + 1); f(x1, y1, x2 + 1, y2); } } void solve() { cin >> r >> c >> n; for(int i = 1; i <= r; i++){ for(int j = 1; j <= c; j++){ x[i][j] = 'b'; } } for(int i = 1; i <= n; i++){ int x1, y1; cin >> x1 >> y1; x[x1][y1] = 'g'; } for(int i = 1; i <= r; i++){ for(int j = 1; j <= c; j++){ f(i, j, i, j); } } int q; cin >> q; while(q--){ int x1, y1, x2, y2; cin >> x1 >> y1 >> x2 >> y2; bool ok = 0; for(pair < int, int > as : ans[x1][y1]){ if(as.F == x2 && as.S == y2){ ok = 1; break; } } if(!ok){ cout << "No" << xa; } else cout << "Yes" << xa; } } signed main() { gold; //freopen("sum2.in", "r", stdin); //freopen("sum2.out", "w", stdout); int t = 1; int ti = 1; //cin >> t; while (t--) { //cout << "Case " << ti << ": "; solve(); ti++; } }
#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...