QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#83327#2838. 2D Geometryuniecho1#WA 2ms3376kbC++141.0kb2023-03-01 13:58:402023-03-01 13:58:42

Judging History

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

  • [2023-08-10 23:21:45]
  • System Update: QOJ starts to keep a history of the judgings of all the submissions.
  • [2023-03-01 13:58:42]
  • 评测
  • 测评结果:WA
  • 用时:2ms
  • 内存:3376kb
  • [2023-03-01 13:58:40]
  • 提交

answer

#include <bits/stdc++.h>
#define int long long
using namespace std;

const int MAXN = 2e5 + 5;

int N;
int x[MAXN], y[MAXN];

mt19937 rd;

signed main() {
    // freopen("in.txt", "r", stdin);
    ios::sync_with_stdio(false);
    rd.seed(19260817);
    while (cin >> N) {
        for (int i = 1; i <= N; i++)
            cin >> x[i] >> y[i];
        bool flag = false;
        int M;
        for (int o = 1; o <= 50; o++) {
            int id1 = rd() * rd() % N + 1;
            int id2 = rd() * rd() % N + 1;
            int x1 = x[id1], y1 = y[id1], x2 = x[id2], y2 = y[id2];
            if (id1 == id2) continue;
            M = 0;
            for (int i = 1; i <= N; i++) {
                int x3 = x[i], y3 = y[i];
                if ((y1 - y2) * (x3 - x2) == (y3 - y1) * (x1 - x2)) ++M;
            }
            if (M + M / 2 > N) {
                flag = true;
                break;
            }
        }
        cout << (flag ? M - 2 * (N - M) : N % 3) << endl;
    }

    return 0;
}

详细

Test #1:

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

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

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

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:

1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1
1

result:

wrong answer 12th lines differ - expected: '4', found: '1'