# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
523867 | 2022-02-08T10:12:57 Z | iskhakkutbilim | Trampoline (info1cup20_trampoline) | C++14 | 386 ms | 1048580 KB |
// Author: Tazhibaev Iskhak #include <bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp> using namespace __gnu_pbds; using namespace std; typedef tree<pair<int, int> ,null_type,less< pair<int, int> >,rb_tree_tag, tree_order_statistics_node_update> ordered_set; const long double pi = acos((long double) - 1.0); const double eps = (double)1e-9; const int INF = 1e9 + 7; #define ff first #define ss second #define ll long long #define ld long double #define pb push_back void usaco( string filename){ freopen((filename+".in").c_str(), "r", stdin); freopen((filename+".out").c_str(), "w", stdout); } int r, c, n; int in(int i, int j){ if(i >= 1 and i <= r and j >= 1 and j <= c) return 1; return 0; } main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); cin >> r >> c >> n; set< pair<int, int> > st; vector<int> g[r + 1]; for(int i = 0;i < n; i++){ int x, y; cin >> x >> y; st.insert({x, y}); } for(auto it : st){ g[it.ff].push_back(it.ss); } int T; cin >> T; while(T--){ pair<int, int> start; cin >> start.ff >> start.ss; pair<int, int> end; cin >> end.ff >> end.ss; int x, y; if(end.ff - start.ff == 1){ assert(false); x = start.ff; y = start.ss; while(x < end.ff and x <= r and y <= c){ int L = lower_bound(g[x].begin(), g[x].end(), y) - g[x].begin(); if(L >= g[x].size()) break; y = g[x][L]; x++; } if(x == end.ff and y <= end.ss) cout << "Yes"; else cout << "No"; cout << "\n"; }else if(end.ff == start.ff and end.ss >= end.ff){ cout << "Yes" << "\n"; continue; }else if(end.ff < start.ff ){ cout << "No" << "\n"; continue; }else if(end.ss < start.ss){ cout << "No" << "\n"; continue; } x = start.ff; y = start.ss; while(x != end.ff){ if(y == c) break; if(y > end.ss) break; if(st.count({x, y})) x++; else y++; } if(x == end.ff and y <= end.ss) cout << "Yes"; else cout << "No"; cout << "\n"; } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 4 ms | 1356 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 182 ms | 22148 KB | Execution killed with signal 6 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 383 ms | 1048580 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 386 ms | 1048576 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Runtime error | 382 ms | 1048580 KB | Execution killed with signal 9 |
2 | Halted | 0 ms | 0 KB | - |