이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#define fi first
#define se second
#define pb push_back
#define sz(a) (int)a.size()
#define all(a) a.begin(),a.end()
#define rep(i,n) for(int i=0;i<n;i++)
#define crep(i,x,n) for(int i=x;i<n;i++)
#define drep(i,n) for(int i=n-1;i>=0;i--)
#define vec(...) vector<__VA_ARGS__>
#define _32bB6rn ios_base::sync_with_stdio(false),cin.tie(0),cout.tie(0)
using namespace std;
typedef long long ll;
typedef long double ld;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
using vi=vector<int>;
ld ccw(pll a,pll b,pll c){
return (ld)a.fi * (b.se - c.se) +
(ld)b.fi * (c.se - a.se) +
(ld)c.fi * (a.se - b.se);
}
bool get(pll a,pll b,pll c){
return ccw(a,b,c)<0;
}
int main(){
_32bB6rn;
ll _t;
cin>>_t;
int n;
cin>>n;
vec(pll) a(n);
rep(i,n){
cin>>a[i].fi>>a[i].se;
}
auto affine=[&](int i,pll p){
int j=(i+n/2+1+n)%n;
bool pok=!get(a[i],a[(i+1)%n],p) and get(a[j],a[(j-1+n)%n],p);
pok=pok or (get(a[(i+1)%n],a[i],p) and !get(a[(j-1+n)%n],a[j],p));
// cout<<get(a[j],a[(j-1+n)%n],p)<<"\n";
return pok;
};
int q;
cin>>q;
ll ans=0;
rep(_,q){
ll x,y;
cin>>x>>y;
x=x^(_t*ans*ans*ans);
y=y^(_t*ans*ans*ans);
// cout<<x<<" "<<y<<"\n";
bool pok=0;
rep(i,n/2){
if(affine(i,pll{x,y})){
pok=1;
break;
}
}
cout<<(pok?"DA\n":"NE\n");
ans+=pok;
}
//
return 0;
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |