# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
426828 | tqbfjotld | Trampoline (info1cup20_trampoline) | C++14 | 481 ms | 30144 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
vector<pair<int,int> > items;
int decomp[200005][20];
int main(){
int R,C,n;
scanf("%d%d%d",&R,&C,&n);
for (int x = 0; x<n; x++){
int a,b;
scanf("%d%d",&a,&b);
items.push_back({a,b});
}
sort(items.begin(),items.end());
for (int x = 0; x<n; x++){
int num = lower_bound(items.begin(),items.end(),make_pair(items[x].first+1,items[x].second))-items.begin();
if (num==n) decomp[x][0] = n;
else if (items[num].first!=items[x].first+1){
decomp[x][0] = n;
}
else{
decomp[x][0] = num;
}
}
decomp[n][0] = n;
for (int x = 1; x<20; x++){
for (int y = 0; y<=n; y++){
decomp[y][x] = decomp[decomp[y][x-1]][x-1];
}
}
int q;
scanf("%d",&q);
for (int x = 0; x<q; x++){
int a,b,c,d;
scanf("%d%d%d%d",&a,&b,&c,&d);
if (a>c || b>d){
printf("No\n");
continue;
}
if (a==c){
printf("Yes\n");
continue;
}
int num = lower_bound(items.begin(),items.end(),make_pair(a,b))-items.begin();
if (items[num].first!=a){
printf("No\n");
continue;
}
int diff = c-a-1;
for (int x = 0; x<20; x++){
if (diff&(1<<x)){
num = decomp[num][x];
}
}
if (num==n){
printf("No\n");
continue;
}
if (items[num].second>d){
printf("No\n");
continue;
}
printf("Yes\n");
}
}
컴파일 시 표준 에러 (stderr) 메시지
# | 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... |