QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#610939#9434. Italian CuisineAcestarWA 33ms19384kbC++141.5kb2024-10-04 18:09:252024-10-04 18:09:25

Judging History

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

  • [2024-10-04 18:09:25]
  • 评测
  • 测评结果:WA
  • 用时:33ms
  • 内存:19384kb
  • [2024-10-04 18:09:25]
  • 提交

answer

#include <bits/stdc++.h>

using namespace std;

#define int long long

const int N = 1e6 + 5;
#define eps 1e-12

int n, r;

struct Point
{
  int x, y;
  Point(int _x = 0, int _y = 0) {x = _x, y = _y;}
  friend Point operator - (Point a, Point b) {
    return Point(a.x - b.x, a.y - b.y);
  }
  friend int operator * (Point a, Point b) {
    return a.x * b.y - a.y * b.x;
  }
} O, a[N];

struct Line {int a, b, c;};
double DIS(Point a, Line l) {return fabs((double)(l.a * a.x + l.b * a.y + l.c) / sqrtl(l.a * l.a + l.b * l.b));}

int _abs(int x) {return x < 0 ? -x : x;}

void solve()
{
  cin >> n >> O.x >> O.y >> r;
  for(int i = 1; i <= n; i++) cin >> a[i].x >> a[i].y, a[n + i] = a[i];

  int S = 0, Ans = 0;
  for(int i = 1, j = 1; i <= n; i++)
  {
    while(((a[i] - O) * (a[j] - O)) * ((a[i] - O) * (a[j + 1] - O)) >= 0)
    {
      Line L; L.a = a[i].y - a[j + 1].y, L.b = a[j + 1].x - a[i].x, L.c = a[i].x * a[j + 1].y - a[i].y * a[j + 1].x;
      // if(DIS(O, L) < r) break;
      if((__int128)(L.a * O.x + L.b * O.y + L.c) * (L.a * O.x + L.b * O.y + L.c) < (__int128)r * r * (L.a * L.a + L.b * L.b)) break;
      j++;
      if(j - i >= 2) S += _abs((a[j - 1] - a[i]) * (a[j] - a[i]));
    }
    // cerr << i << " " << j << ": " << S << "\n";
    if(S > Ans) Ans = S;
    if(j - i >= 2) S -= _abs((a[i] - a[j]) * (a[i + 1] - a[j]));
  }
  cout << Ans << "\n";
  return;
}

signed main()
{
  ios::sync_with_stdio(0);
  cin.tie(0), cout.tie(0);

  int T; cin >> T;
  while(T--) solve();
  return 0;
}

详细

Test #1:

score: 100
Accepted
time: 3ms
memory: 19264kb

input:

3
5
1 1 1
0 0
1 0
5 0
3 3
0 5
6
2 4 1
2 0
4 0
6 3
4 6
2 6
0 3
4
3 3 1
3 0
6 3
3 6
0 3

output:

5
24
0

result:

ok 3 number(s): "5 24 0"

Test #2:

score: 0
Accepted
time: 3ms
memory: 19264kb

input:

1
6
0 0 499999993
197878055 -535013568
696616963 -535013568
696616963 40162440
696616963 499999993
-499999993 499999993
-499999993 -535013568

output:

0

result:

ok 1 number(s): "0"

Test #3:

score: 0
Accepted
time: 11ms
memory: 19384kb

input:

6666
19
-142 -128 26
-172 -74
-188 -86
-199 -157
-200 -172
-199 -186
-195 -200
-175 -197
-161 -188
-144 -177
-127 -162
-107 -144
-90 -126
-87 -116
-86 -104
-89 -97
-108 -86
-125 -80
-142 -74
-162 -72
16
-161 -161 17
-165 -190
-157 -196
-154 -197
-144 -200
-132 -200
-128 -191
-120 -172
-123 -163
-138...

output:

5093
3086
2539
668
3535
7421
4883
5711
5624
1034
2479
3920
4372
2044
4996
5070
2251
4382
4175
1489
1154
3231
4038
1631
5086
14444
1692
6066
687
1512
4849
5456
2757
8341
8557
8235
1013
5203
10853
6042
6300
4480
2303
2728
1739
2187
3385
4266
6322
909
4334
1518
948
5036
1449
2376
3180
4810
1443
1786
47...

result:

ok 6666 numbers

Test #4:

score: -100
Wrong Answer
time: 33ms
memory: 19256kb

input:

6660
19
-689502500 -712344644 121094647
-534017213 -493851833
-578925616 -506634533
-663335128 -540066520
-748890119 -585225068
-847722967 -641694086
-916653030 -716279342
-956235261 -766049951
-1000000000 -836145979
-963288744 -923225928
-948140134 -944751289
-920681768 -972760883
-872492254 -10000...

output:

69855325218433566
53085313122339640
80517997340888983
25209253986594820
18636849319592841
53171057323874107
5099669152823584
13807495628667900
53683745618902532
22391622080548020
99135403119618053
121474787211236918
65446465752117722
9001722648548373
44725767237343478
6715672727147745
20327827690487...

result:

wrong answer 1st numbers differ - expected: '117285633945667137', found: '69855325218433566'