Submission #440432

# Submission time Handle Problem Language Result Execution time Memory
440432 2021-07-02T09:10:26 Z sam571128 Hexagonal Territory (APIO21_hexagon) C++17
0 / 100
10 ms 1612 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]==1) nowy += L[i-1];
        if(D[i-1]==2) nowx += L[i-1], nowy += L[i-1];
        if(D[i-1]==3) nowx += L[i-1];
        if(D[i-1]==4) nowy -= L[i-1];
        if(D[i-1]==5) nowx -= L[i-1], nowy -= L[i-1];
        if(D[i-1]==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 Correct 1 ms 204 KB Output is correct
2 Correct 3 ms 460 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 296 KB Output is correct
5 Correct 2 ms 332 KB Output is correct
6 Correct 2 ms 460 KB Output is correct
7 Correct 8 ms 1100 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 296 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 10 ms 1612 KB Output is correct
12 Correct 10 ms 1612 KB Output is correct
13 Correct 9 ms 1484 KB Output is correct
14 Correct 10 ms 1612 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Incorrect 1 ms 204 KB Output isn't correct
18 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 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -