이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
void solve() {
int n, m, green;
cin >> n >> m >> green;
vector <vector <int>> a(n + 1, vector <int> (m + 1, 1));
for(int i = 0; i < green; i ++) {
int x, y;
cin >> x >> y;
a[x - 1][y - 1] = 2;
}
int q;
cin >> q;
while(q --) {
pair <int, int> start, end;
cin >> start.first >> start.second;
cin >> end.first >> end.second;
start.first --;
start.second --;
end.first --;
end.second --;
vector <vector <int>> ans(n + 1, vector <int> (m + 1, 0));
ans[start.first][start.second] = 1;
for(int i = start.first; i <= end.first; i ++) {
for(int j = start.second; j <= end.second; j ++){
ans[i][j + 1] = max(ans[i][j], ans[i][j + 1]);
if(a[i][j] == 2) {
ans[i+1][j] = max(ans[i][j], ans[i + 1][j]);
}
}
}
if(ans[end.first][end.second] == 1) cout << "Yes\n";
else cout << "No\n";
end:;
}
}
int main() {
ios::sync_with_stdio(0);
cin.tie(0);
int Q = 1;
//cin >> Q;
while (Q --) {
solve();
}
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
trampoline.cpp: In function 'void solve()':
trampoline.cpp:38:3: warning: label 'end' defined but not used [-Wunused-label]
38 | end:;
| ^~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |