답안 #440434

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
440434 2021-07-02T09:12:17 Z sam571128 육각형 영역 (APIO21_hexagon) C++17
30 / 100
55 ms 7784 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) {
    ll 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 (int)(ans*A%MOD);
}


//Subtask: B=0 => count the area 
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 1 ms 204 KB Output is correct
5 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 288 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 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 204 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 3 ms 460 KB Output is correct
7 Correct 9 ms 1228 KB Output is correct
8 Correct 1 ms 204 KB Output is correct
9 Correct 1 ms 204 KB Output is correct
10 Correct 1 ms 204 KB Output is correct
11 Correct 10 ms 1740 KB Output is correct
12 Correct 15 ms 1828 KB Output is correct
13 Correct 9 ms 1692 KB Output is correct
14 Correct 10 ms 1868 KB Output is correct
15 Correct 1 ms 204 KB Output is correct
16 Correct 1 ms 204 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Correct 1 ms 204 KB Output is correct
4 Correct 2 ms 460 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 204 KB Output is correct
7 Correct 2 ms 460 KB Output is correct
8 Correct 3 ms 588 KB Output is correct
9 Correct 7 ms 1356 KB Output is correct
10 Correct 1 ms 296 KB Output is correct
11 Correct 1 ms 296 KB Output is correct
12 Correct 1 ms 288 KB Output is correct
13 Correct 10 ms 1996 KB Output is correct
14 Correct 15 ms 1956 KB Output is correct
15 Correct 10 ms 1880 KB Output is correct
16 Correct 11 ms 2080 KB Output is correct
17 Correct 1 ms 332 KB Output is correct
18 Correct 1 ms 204 KB Output is correct
19 Correct 1 ms 204 KB Output is correct
20 Correct 21 ms 3276 KB Output is correct
21 Correct 4 ms 588 KB Output is correct
22 Correct 1 ms 332 KB Output is correct
23 Correct 23 ms 4332 KB Output is correct
24 Correct 42 ms 6752 KB Output is correct
25 Correct 48 ms 7212 KB Output is correct
26 Correct 18 ms 3680 KB Output is correct
27 Correct 16 ms 2764 KB Output is correct
28 Correct 11 ms 1868 KB Output is correct
29 Correct 54 ms 7784 KB Output is correct
30 Correct 47 ms 7740 KB Output is correct
31 Correct 55 ms 7736 KB Output is correct
32 Correct 43 ms 7480 KB Output is correct
33 Correct 20 ms 3716 KB Output is correct
34 Correct 10 ms 1948 KB Output is correct
35 Correct 1 ms 204 KB Output is correct
36 Correct 1 ms 204 KB Output is correct
37 Correct 1 ms 204 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 204 KB Output is correct
3 Incorrect 1 ms 204 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -