답안 #365962

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
365962 2021-02-12T15:25:07 Z Ahmadsm2005 Trampoline (info1cup20_trampoline) C++14
43 / 100
181 ms 4588 KB
#include <bits/stdc++.h>
#define endl '\n'
#define modulo 998244353
//#define int long long
#define PI acos(-1)
#pragma GCC optimize("-Ofast")
//#pragma GCC optimize("trapv")
#pragma GCC target("sse,sse2,sse3,ssse3,sse4,sse4.2,popcnt,abm,mmx,avx2,tune=native")
#pragma GCC optimize("-ffast-math")
#pragma GCC optimize("-funroll-loops")
#pragma GCC optimize("-funroll-all-loops,-fpeel-loops,-funswitch-loops")
#define sinDegrees(x) sin((x) * PI / 180.0)
#define cosDegrees(x) cos((x) * PI / 180.0)
#define tanDegrees(x) tan((x) * PI / 180.0)
#define atanDegrees(x) atan(x)* 180.0 / PI
#define asinDegrees(x) asin(x)* 180.0 / PI
#define EPS 0.000000001
using namespace std;
int power(int x,int y,int m)
{
int temp;
if(y == 0)
return 1;
temp = (power(x, y/2,m))%m;
if (y%2 == 0)
return ((temp%m)*temp);
else
return ((x*temp%m)*temp%m)%m;
}
int inv(int x,int m=modulo)
{
return (power(x,m-2,m))%m;
}
///IOI 2021 isA
int R,C,N,T,X,Y,X2,Y2;
pair<int,int>lolz[200001],lolq;
vector<int>lol;
int32_t main()
{
//freopen("output.txt","w",stdout);
//freopen("sorting.in","r",stdin);
cin.tie(0),iostream::sync_with_stdio(0);
cin>>R>>C>>N;
lol.push_back(-1);
for(int i=0;i<N;i++){
cin>>Y>>X;
lolz[i]={Y,X};
}
sort(lolz,lolz+N);
int DUDE=lolz[0].first;
for(int i=1;i<N;i++){
if(lolz[i].first!=DUDE)
DUDE=lolz[i].first,lol.push_back(i);
}
cin>>T;
while(T--){
cin>>Y>>X>>Y2>>X2;
int LASTX=X;
if(Y2<Y){
cout<<"NO"<<endl;
goto a;
}
if(Y-Y2>N){
cout<<"NO"<<endl;
goto a;
}
for(int i=Y;i<Y2;i++){
int L=lol[i-1],R=lol[i],mid,BEST=INT_MAX;
while(L<=R){
mid=(L+R)/2;
lolq=lolz[mid];
if(lolq.first<i)
L=mid+1;
else if(lolq.first>i)
R=mid-1;
else if(lolq.second<LASTX)
L=mid+1;
else
BEST=min(BEST,lolq.second),R=mid-1;
}
LASTX=BEST;
}
if(LASTX<=X2){
cout<<"YES"<<endl;
}
else
cout<<"NO"<<endl;
a:;
}
return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 364 KB 200 token(s): yes count is 21, no count is 179
2 Correct 3 ms 364 KB 200 token(s): yes count is 70, no count is 130
3 Correct 3 ms 364 KB 197 token(s): yes count is 25, no count is 172
# 결과 실행 시간 메모리 Grader output
1 Correct 142 ms 1900 KB 4000 token(s): yes count is 99, no count is 3901
2 Correct 140 ms 1900 KB 4000 token(s): yes count is 91, no count is 3909
3 Correct 117 ms 1924 KB 4000 token(s): yes count is 4000, no count is 0
4 Correct 181 ms 2156 KB 4000 token(s): yes count is 1991, no count is 2009
# 결과 실행 시간 메모리 Grader output
1 Runtime error 71 ms 3856 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 3 ms 620 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Runtime error 74 ms 4588 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -