Submission #440429

# Submission time Handle Problem Language Result Execution time Memory
440429 2021-07-02T09:08:52 Z sam571128 Hexagonal Territory (APIO21_hexagon) C++14
0 / 100
1 ms 204 KB
#include "hexagon.h"
#include <bits/stdc++.h>

#define ll long long

using namespace std;


int draw_territory(int N, int A, int B, vector<int> D, vector<int> L) {
    int x[N+1], y[N+1], nowx = 0, nowy = 0, MOD = 1e9+7, peri = 0;
    x[0] = y[0] = 0;
    for(int i = 1;i <= N;i++){
        if(D[i]==1) nowy += L[i-1];
        if(D[i]==2) nowx += L[i-1], nowy += L[i-1];
        if(D[i]==3) nowx += L[i-1];
        if(D[i]==4) nowy -= L[i-1];
        if(D[i]==5) nowx -= L[i-1], nowy -= L[i-1];
        if(D[i]==6) nowx -= L[i-1];
        x[i] = nowx, y[i] = nowy;
        peri = (peri+L[i-1])%MOD;
    }

    ll ans = 0;

    for(int i = 0;i <= N;i++){
        ans += x[i]*y[i+1]-x[i+1]*y[i];
    }

    ans = ((((abs(ans)-peri)/2 + 1)%MOD + MOD)%MOD + peri)%MOD;
    return ans*A%MOD;
}


//Subtask: B=0 => count the area 
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -