Submission #764416

# Submission time Handle Problem Language Result Execution time Memory
764416 2023-06-23T11:38:15 Z Ellinor Spiral (BOI16_spiral) C++14
0 / 100
1 ms 212 KB
#include <bits/stdc++.h>
using namespace std;

#define rep(i,a,b) for(int i = (a); i < (b); i++)
typedef long long ll;

int N,q;

int32_t main()
{
    cin>>N>>q;
    //

    int x1, y1, x2, y2;
    rep(i,0,q)
    {
        cin>>x1>>y1>>x2>>y2;
        
        // if(N<=1000)
        // {
        //     //
        // }

        if(x1==x2 && y1==y2)
        {
            ll circle = max(abs(x1),abs(y1));
            ll root = circle*2;
            root++;
            ll square = root*root;
            
            ll ans;
            if(y1==(-circle)){
                ll diff = circle - x1;
                ans = square - diff;
            }
            else if(x1==(-circle)){
                ll diff = circle + y1;
                diff += circle;
                diff += circle;
                ans = square - diff;
            }
            else if(y1==circle){
                ll diff = circle*4;
                diff += circle + x1;
                ans = square - diff;
            }
            else{
                ll diff = circle*6;
                diff += (circle - y1);
                ans = square - diff;
            }

            cout<<ans<<"\n";
        }
    }
}
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -