QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#223833 | #2838. 2D Geometry | OMoonStars | WA | 1ms | 3620kb | C++14 | 1.2kb | 2023-10-22 17:42:15 | 2023-10-22 17:42:17 |
Judging History
answer
#include<algorithm>
#include<array>
#include<bitset>
#include<cmath>
#include<cstdio>
#include<cstring>
#include<iomanip>
#include<iostream>
#include<map>
#include<numeric>
#include<queue>
#include<set>
#include<unordered_map>
#include<random>
#define fi first
#define se second
#define pb push_back
#define mp make_pair
#define endl '\n'
using namespace std;
using ll=long long;
using db=double;
using pll=pair<ll,ll>;
const int inf=0x3f3f3f3f;
const int mod=998244353;
const int N=2e5+10,M=1e3+10;
pll p[N];
int main()
{
ios::sync_with_stdio(false);
cin.tie(nullptr);
random_device rd;
mt19937 rng(rd());
int n;
while(cin >> n)
{
for(int i=0;i<n;i++)
cin >> p[i].fi >> p[i].se;
int t=500,ans=n;
while(t--)
{
shuffle(p,p+n,rng);
for(int i=2;i<n;i+=3)
{
int res=n%3;
sort(p+i-2,p+i+1);
if((p[i].fi-p[i-1].fi)*(p[i-1].se-p[i-2].se)==(p[i-1].fi-p[i-2].fi)*(p[i].se-p[i-1].se))
res+=3;
ans=min(ans,res);
}
}
cout << ans << endl;
}
return 0;
}
詳細信息
Test #1:
score: 100
Accepted
time: 0ms
memory: 3588kb
input:
3 0 0 0 1 0 2 3 0 0 0 1 1 0 6 0 0 0 1 0 2 0 3 1 1 1 2
output:
3 0 0
result:
ok 3 lines
Test #2:
score: -100
Wrong Answer
time: 1ms
memory: 3620kb
input:
1 0 0 2 0 0 1 1 3 0 0 0 1 0 2 3 0 0 0 1 1 0 4 3 0 0 2 3 3 3 1 4 2 3 1 1 0 3 0 2 4 0 0 0 3 0 2 0 1 5 8 6 9 2 2 3 7 4 1 5 5 2 2 4 2 6 2 7 2 0 4 5 3 7 5 4 4 4 9 4 9 9 5 5 4 5 9 5 5 4 3 1 0 5 3 2 1 2 7 2 6 2 5 2 6 7 2 7 9 0 3 8 8 4 4 3 8 6 2 8 2 5 3 5 3 8 2 0 0 2 6 2 3 8 4 2 9 2 2 2 6 4 9 6 2 1 7 6 6 5 ...
output:
1 2 3 0 1 1 4 2 2 2 2 5 0 0 0 0 0 0 0 0 0 3
result:
wrong answer 20th lines differ - expected: '3', found: '0'