QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#368130 | #2838. 2D Geometry | hshshs# | Compile Error | / | / | C++20 | 1.0kb | 2024-03-26 21:00:34 | 2024-03-26 21:00:34 |
Judging History
answer
#include<bits/stdc++.h>
#define maxn 100010
using namespace std;
int n,q,a1,a2;
string s;
void solve() {
vector<pair<int, int>> p;
for (int i = 0; i < n; ++i)
{
int x, y;
cin >> x >> y;
p.push_back({x, y});
}
int tmp = 0;
for (int kase = 0; kase < 20; kase++) {
auto get = [&](int L, int R) {
return (rand() << 15 | rand()) % R + L;
};
int u = get(2, n);
int v = get(1, u - 1);
pair<int,int> line = [&](int u, int v) {
return {p[u].first - p[v].fisrt, p[u].second - p[v].second};
};
auto online = [&](int u, int v, int w) {
auto x = line(u, v), y = line(v, w);
return x.first * y.second - x.second * y.first;
};
int res=0;
for (int i = 1; i <= n; ++i) {
if (online(u, v, i)) res++;
}
tmp = max(tmp, res);
}
if (tmp >= 2* (n - tmp)) {
cout << tmp - 2 * (n - tmp) << '\n';
} else {
cout << n % 3 << '\n';
}
}
int main() {
// freopen("1.in", "r", stdin);
ios::sync_with_stdio(false);
while (cin >> n) {
solve();
}
return 0;
}
Details
answer.code: In lambda function: answer.code:24:51: error: ‘__gnu_cxx::__alloc_traits<std::allocator<std::pair<int, int> >, std::pair<int, int> >::value_type’ {aka ‘struct std::pair<int, int>’} has no member named ‘fisrt’; did you mean ‘first’? 24 | return {p[u].first - p[v].fisrt, p[u].second - p[v].second}; | ^~~~~ | first answer.code:24:83: error: returning initializer list 24 | return {p[u].first - p[v].fisrt, p[u].second - p[v].second}; | ^ answer.code: In function ‘void solve()’: answer.code:23:38: error: conversion from ‘solve()::<lambda(int, int)>’ to non-scalar type ‘std::pair<int, int>’ requested 23 | pair<int,int> line = [&](int u, int v) { | ^~~~~~~~~~~~~~~~~~~ 24 | return {p[u].first - p[v].fisrt, p[u].second - p[v].second}; | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 25 | }; | ~ answer.code: In lambda function: answer.code:27:38: error: no match for call to ‘(std::pair<int, int>) (int&, int&)’ 27 | auto x = line(u, v), y = line(v, w); | ~~~~^~~~~~ answer.code:28:42: error: ‘y’ was not declared in this scope 28 | return x.first * y.second - x.second * y.first; | ^