QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#605434#9434. Italian Cuisinecode_side-effectWA 0ms3588kbC++202.1kb2024-10-02 17:14:062024-10-02 17:14:08

Judging History

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

  • [2024-10-02 17:14:08]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3588kb
  • [2024-10-02 17:14:06]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
using i128 = __int128_t;

const int N = 1e5+5;

template <typename T>
inline void read(T &x)
{
    T f = 1;
    x = 0;
    char ch = getchar();
    while (0 == isdigit(ch))
    {
        if (ch == '-')
            f = -1;
        ch = getchar();
    }
    while (0 != isdigit(ch))
        x = (x << 1) + (x << 3) + ch - '0', ch = getchar();
    x *= f;
}

template <typename T>
inline void write(T x)
{
    if (x < 0)
    {
        x = ~(x - 1);
        putchar('-');
    }
    if (x > 9)
        write(x / 10);
    putchar(x % 10 + '0');
}

struct Point{
    i128 x , y ; 
};


i128 dot(Point a, Point b) { 
    return a.x * b.x + a.y * b.y;
}

i128 cross(Point a, Point b) {
    return a.x * b.y - b.x * a.y;
}

i128 mul(Point a) {
    return dot(a,a);
}

Point del(Point a , Point b){
    return {a.x - b.x , a.y - b.y} ;
}

void solve(){
    int n ; 
    read(n) ;
    Point c ; 
    read(c.x) ;
    read(c.y) ;
    i128 r ;
    read(r) ;
    vector<Point> a(n) ;
    for(int i = 0 ;i < n ;i++){
        read(a[i].x) ;
        read(a[i].y) ;
    }
    i128 ans = 0 , temp = 0;
    for(int lo = 0 , hi = lo + 1; lo < n ;lo++){
       
        while(true){
            int next_r = hi % n + 1;
            i128 add_s = cross(del(a[next_r] , a[lo]) , del(c , a[lo])) ;
            if(add_s <= 0){
                break ;
            }
            if(add_s * add_s < mul(del(a[next_r] , a[lo])) *  r *  r ){
                break ;
            }
            temp += cross(del(a[hi] , a[lo]) , del(a[next_r] , a[lo])) ;
            hi = next_r ; 
      //  cerr << n << " " <<  lo << " " << hi << " " << next_r << "\n";
        }

        ans = max(ans , temp) ; 
        int next_l = lo % n + 1 ;
        temp -= cross(del(a[hi] , a[lo]) , del(a[hi] , a[next_l])) ;
    }
   write(ans) ;
   putchar('\n');
}


int main(){
    // ios::sync_with_stdio(false);
    // cin.tie(nullptr) ;
    int tt = 1 ;
    read(tt) ;
    while(tt--){
        solve() ;
    }
    return 0;
}


Details

Tip: Click on the bar to expand more detailed information

Test #1:

score: 0
Wrong Answer
time: 0ms
memory: 3588kb

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:

0
24
0

result:

wrong answer 1st numbers differ - expected: '5', found: '0'