QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#63836#2838. 2D Geometrypty6666WA 2ms5468kbC++14894b2022-11-23 14:33:292022-11-23 14:33:34

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2022-11-23 14:33:34]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:5468kb
  • [2022-11-23 14:33:29]
  • 提交

answer

#include <cstdio>
#include <cstring>
#include <queue>
#include <algorithm>
#include <iostream>
#include <cmath>
#include <random>
#include <ctime>
using namespace std;
typedef long long ll;
const int maxn = 2e6 + 10;
int n;
ll x[maxn],y[maxn];

int main() {
	mt19937 rnd(time(0));
	ios::sync_with_stdio( 0 );
	cin.tie( 0 );
	cout.tie( 0 );
	while(cin >> n){
		for(int i = 1;i<=n;i++){
			cin >> x[i] >> y[i];
		}
		int cnt = 100;
		int maxx = 0;
		while(cnt--){
			int a = rnd() % n + 1;
			int b = rnd() % n + 1;
			if(a == b)
				continue;
			int num = 0;
			for(int i = 1;i<=n;i++){
				if((x[i] - x[a]) * (y[i] - y[b]) - (x[i] - x[b]) * (y[i] - y[a]) == 0){
					num++;
				}
			}
			maxx = max(num,maxx);
		}
		if(maxx <= (n - n % 3) / 3 * 2){
			cout << n % 3 << "\n";
		}
		else {
			cout << n - 3 * (n - maxx) << "\n";
		}
	}
	return 0;
}

详细

Test #1:

score: 100
Accepted
time: 2ms
memory: 5468kb

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: 2ms
memory: 5312kb

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

result:

wrong answer 10th lines differ - expected: '2', found: '-1'