Submission #68364496
Source Code Expand
#include<bits/stdc++.h>
using ll=long long;
using namespace std;
int read(){int f=0,x=0;char a=getchar();while(!isdigit(a)){if(a=='-')f=1;a=getchar();}while(isdigit(a)){x=x*10+a-'0';a=getchar();}if(f)return -x;return x;}
struct node
{
ll x,y;
};
vector<node>a(2000+1);
struct nod
{
ll a1,a2;
friend bool operator<(nod c,nod d)
{
ll dx=a[c.a1].x-a[c.a2].x;
ll dy=a[c.a1].y-a[c.a2].y;
ll dxx=a[d.a1].x-a[d.a2].x;
ll dyy=a[d.a1].y-a[d.a2].y;
if(!dx&&dxx)
{
return 0;
}
if(!dxx&&dx)
{
return 1;
}
return dx*dyy<dxx*dy;
}
};
int main()
{
//freopen(in.in,r,stdin);
//freopen(out.out,w,stdout);
ios::sync_with_stdio(false);
cin.tie(0);
int tttt=1;
//cin>>tttt;
while(tttt--)
{
ll n,ans=0;cin>>n;
multiset<nod>q;
for(int i=1;i<=n;i++)
{
cin>>a[i].x>>a[i].y;
}
sort(a.begin()+1,a.begin()+n+1,[](node c,node d){return c.x<d.x;});
q.insert({2,1});
q.insert({3,1});
q.insert({3,2});
// for(int i=1;i<=n;i++)
// {
// cout<<a[i].x<<' '<<a[i].y<<'\n';
// }
for(int i=4;i<=n;i++)
{
bool yw=0;
// for(auto j:q)
// {
// cout<<j.a1<<' '<<j.a2<<'\n';
// }
for(int j=1;j<i;j++)
{
auto l=q.lower_bound({i,j});
auto r=q.upper_bound({i,j});
for(auto it=l;it!=r;it++)
{
auto [p1,p2]=*it;
if(a[p1].x-a[p2].x==a[i].x-a[j].x&&a[p1].y-a[p2].y==a[i].y-a[j].y)
{
if(yw)
{
ans++;
}
yw=!yw;
}
else
{
ans++;
}
//cout<<i<<" "<<j<<" "<<p1<<" "<<p2<<' '<<yw<<'\n';
}
}
for(int j=1;j<i;j++)
{
q.insert({i,j});
}
}
cout<<ans<<'\n';
}
return 0;
}
Submission Info
| Submission Time | |
|---|---|
| Task | E - Trapezium |
| User | evilwater |
| Language | C++ 23 (gcc 12.2) |
| Score | 0 |
| Code Size | 2360 Byte |
| Status | WA |
| Exec Time | 4418 ms |
| Memory | 128604 KiB |
Judge Result
| Set Name | Sample | All | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 0 / 475 | ||||||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | 00-sample-01.txt, 00-sample-02.txt |
| All | 00-sample-01.txt, 00-sample-02.txt, 01-01.txt, 01-02.txt, 01-03.txt, 01-04.txt, 01-05.txt, 01-06.txt, 01-07.txt, 01-08.txt, 01-09.txt, 01-10.txt, 01-11.txt, 01-12.txt, 01-13.txt, 01-14.txt, 01-15.txt, 01-16.txt, 01-17.txt, 01-18.txt, 01-19.txt, 01-20.txt, 01-21.txt, 01-22.txt, 01-23.txt, 01-24.txt, 01-25.txt, 01-26.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| 00-sample-01.txt | AC | 1 ms | 3460 KiB |
| 00-sample-02.txt | AC | 1 ms | 3544 KiB |
| 01-01.txt | AC | 1 ms | 3668 KiB |
| 01-02.txt | AC | 45 ms | 8432 KiB |
| 01-03.txt | AC | 2343 ms | 105384 KiB |
| 01-04.txt | AC | 914 ms | 56396 KiB |
| 01-05.txt | AC | 3113 ms | 128556 KiB |
| 01-06.txt | AC | 3105 ms | 128380 KiB |
| 01-07.txt | TLE | 4418 ms | 61228 KiB |
| 01-08.txt | TLE | 4418 ms | 61580 KiB |
| 01-09.txt | TLE | 4418 ms | 61828 KiB |
| 01-10.txt | TLE | 4418 ms | 61860 KiB |
| 01-11.txt | TLE | 4414 ms | 61732 KiB |
| 01-12.txt | AC | 2432 ms | 128412 KiB |
| 01-13.txt | AC | 2378 ms | 128384 KiB |
| 01-14.txt | AC | 2890 ms | 128412 KiB |
| 01-15.txt | AC | 2975 ms | 128352 KiB |
| 01-16.txt | AC | 2867 ms | 128556 KiB |
| 01-17.txt | AC | 2877 ms | 128420 KiB |
| 01-18.txt | WA | 1800 ms | 128488 KiB |
| 01-19.txt | AC | 1807 ms | 128380 KiB |
| 01-20.txt | AC | 1876 ms | 128488 KiB |
| 01-21.txt | AC | 2797 ms | 128472 KiB |
| 01-22.txt | WA | 2355 ms | 128468 KiB |
| 01-23.txt | AC | 2371 ms | 128488 KiB |
| 01-24.txt | AC | 2567 ms | 128604 KiB |
| 01-25.txt | AC | 2545 ms | 128360 KiB |
| 01-26.txt | AC | 2692 ms | 128416 KiB |