# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
369180 | denkendoemeer | Dragon 2 (JOI17_dragon2) | C++14 | 4034 ms | 6640 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
#define ll long long
struct pct
{
ll x,y;
pct operator - (pct aux)
{
return {x-aux.x,y-aux.y};
}
ll operator * (pct aux)
{
return 1LL*x*aux.x+1LL*y*aux.y;
}
ll operator ^ (pct aux)
{
return 1LL*x*aux.y-1LL*y*aux.x;
}
};
struct aux
{
pct p;
double a,b;
bool ok;
};
double unghi(pct x,pct y)
{
return ((x*y)/(hypotl(x.x,x.y)*hypotl(y.x,y.y)));
}
const double pi=acos(-1);
vector<aux>g[100005];
int main()
{
//freopen(".in","r",stdin);
//freopen(".out","w",stdout);
int n,m;
scanf("%d%d",&n,&m);
int i;
for(i=0;i<n;i++){
int a,b,c;
scanf("%d%d%d",&a,&b,&c);
g[c].push_back({{a,b},0,0});
}
pct s,t;
scanf("%lld%lld%lld%lld",&s.x,&s.y,&t.x,&t.y);
for(i=1;i<=m;i++){
for(aux &it:g[i]){
it.a=unghi(it.p-s,t-s);
it.b=unghi(it.p-t,s-t);
if (((t-s)^(it.p-s))>0)
it.ok=1;
else
it.ok=0;
}
}
int q;
scanf("%d",&q);
for(i=1;i<=q;i++){
int a,b;
scanf("%d%d",&a,&b);
int ans=0;
for(aux &it1:g[a]){
for(aux &it2:g[b]){
if (it1.ok==it2.ok){
if ((((it1.p-s)^(it2.p-s))>0)!=(((it1.p-t)^(it2.p-t))>0) && (((t-s)^(it2.p-s))>0)==(((it2.p-s)^(it1.p-s))>0))
ans++;
}
else{
if ((((it1.p-s)^(it2.p-s))>0)!=(((it1.p-t)^(it2.p-t))>0))
ans++;
}
}
}
printf("%d\n",ans);
}
return 0;
}
컴파일 시 표준 에러 (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... |