QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#369841 | #2838. 2D Geometry | Z-wzy | WA | 0ms | 3780kb | C++14 | 1.6kb | 2024-03-28 18:30:56 | 2024-03-28 18:30:56 |
Judging History
answer
#include <bits/stdc++.h>
using namespace std;
#define int long long
#define P pair<int,int>
#define debug(x) cerr << #x << ": " << x << '\n'
#define dg(x) cout << #x << " = " << x << '\n'
#define ct(x) cout<<x<<'\n'
#define cct(x,y) cout<<x<<' '<<y<<'\n'
#define ll long long
#define double long double
const int N = 2e5 + 5, mod = 1e9 + 7, inf = 1e17;
double dis(P a, P b){
return sqrt((a.first - b.first) * (a.first - b.first) + (a.second - b.second) * (a.second - b.second));
}
bool ok(P a, P b, P c){
int x1=b.first-a.first,y1=b.second-a.second;
int x2=c.first-a.first,y2=c.second-a.second;
return x1*y2==x2*y1;
}
std::mt19937 rng(std::chrono::steady_clock::now().time_since_epoch().count());
inline int rands(int x) {
return (1ull * rng() * rng() % x + x)%x + 1;
}
inline void run(){
int n;
while(cin >> n){
vector<P> a(n + 1);
for(int i=1;i<=n;i++){
cin >> a[i].first >> a[i].second;
}
if(n <= 2){
cout << n << '\n';
return;
}
int res = 0;
for(int op = 1;op <= 100;op ++){
int u = rands(n);
int v = rands(n);
while(u == v) v = rands(n);
int cnt = 0;
for(int i=1;i<=n;i++){
cnt += ok(a[u], a[v], a[i]);
}
res = max(res, cnt);
}
cout << max(n % 3, res - 2 * (n - res)) << '\n';
}
}
signed main(){
std::ios_base::sync_with_stdio(false);
std::cin.tie(0),std::cout.tie(0);
// int T; std::cin>>T; while(T--)
run(); return 0;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3596kb
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: 0ms
memory: 3780kb
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
result:
wrong answer 2nd lines differ - expected: '2', found: ''