QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#223933#2838. 2D GeometryOMoonStarsWA 1ms3740kbC++14941b2023-10-22 21:15:362023-10-22 21:15:36

Judging History

你现在查看的是最新测评结果

  • [2023-10-22 21:15:36]
  • 评测
  • 测评结果:WA
  • 用时:1ms
  • 内存:3740kb
  • [2023-10-22 21:15:36]
  • 提交

answer

#include <bits/stdc++.h>
#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;
int x[N],y[N];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(nullptr);
    mt19937 rnd(chrono::steady_clock::now().time_since_epoch().count());
    int n;
    while(cin >> n)
    {
        for(int i=0;i<n;i++)
            cin >> x[i] >> y[i];
        int t=500,ans=n%3;
        while(t--)
        {
            int u=rnd()%n+1,v=rnd()%n+1;
            if(u==v)continue;
            int cnt=0;
            for(int i=0;i<n;i++)
                if((ll)(x[i]-x[u])*(y[i]-y[v])==(ll)(x[i]-x[v])*(y[i]-y[u]))cnt++;
            ans=max(ans,cnt-(n-cnt)*2);
        }
        cout << ans << endl;
    }
    return 0;
}

Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 100
Accepted
time: 0ms
memory: 3676kb

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: 0
Accepted
time: 1ms
memory: 3676kb

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
3
0
6

result:

ok 22 lines

Test #3:

score: -100
Wrong Answer
time: 1ms
memory: 3740kb

input:

7
0 1
0 0
7 7
6 2
6 9
4 4
3 5
7
3 7
3 2
9 1
0 6
1 8
5 0
9 5
7
3 7
2 3
4 5
6 7
7 7
5 8
4 7
7
1 6
5 7
7 2
3 5
0 8
8 8
3 8
7
1 8
3 4
8 8
1 9
7 8
1 7
0 0
7
6 9
2 7
4 5
2 1
4 6
2 3
7 6
7
3 1
1 9
5 7
6 6
5 2
5 1
5 3
7
6 4
1 6
7 3
5 4
2 3
0 0
3 2
7
2 9
4 9
8 9
8 0
1 7
2 6
6 2
7
3 5
4 0
4 1
4 3
0 8
4 7
4 6
...

output:

7
1
1
1
7
1
1
7
1
1
1
7
1
1
1
1
1
1
1
1
1

result:

wrong answer 1st lines differ - expected: '1', found: '7'