Submission #983489

# Submission time Handle Problem Language Result Execution time Memory
983489 2024-05-15T15:01:13 Z bachhoangxuan Hexagonal Territory (APIO21_hexagon) C++17
30 / 100
29 ms 4856 KB
#include "hexagon.h"
#include <bits/stdc++.h>
using namespace std;
using i32 = int;
#define int long long
const int mod = 1e9+7;
const int inv2 = (mod+1)/2;
int dx[]={0,0,1,1,0,-1,-1},
    dy[]={0,1,1,0,-1,-1,0};

i32 draw_territory(i32 N, i32 A, i32 B,
                   std::vector<i32> D, std::vector<i32> L) {
    int X=0,Y=0;
    int a=0,b=0;
    for(int i=0;i<N;i++){
        b+=L[i];
        int nX=X+L[i]*dx[D[i]];
        int nY=Y+L[i]*dy[D[i]];
        a+=X*nY-Y*nX;
        X=nX;Y=nY;
    }
    a=(abs(a)+b)%mod;
    a=a*inv2%mod;
    a=(a+1)%mod;
    a=a*A%mod;
    if(!B) return a;
    else return 1003;
}
#undef int
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 440 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 344 KB Output is correct
2 Incorrect 0 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 2 ms 604 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 1 ms 348 KB Output is correct
5 Correct 1 ms 448 KB Output is correct
6 Correct 2 ms 604 KB Output is correct
7 Correct 5 ms 860 KB Output is correct
8 Correct 1 ms 348 KB Output is correct
9 Correct 1 ms 440 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 8 ms 1368 KB Output is correct
12 Correct 7 ms 1372 KB Output is correct
13 Correct 7 ms 1116 KB Output is correct
14 Correct 7 ms 1324 KB Output is correct
15 Correct 1 ms 348 KB Output is correct
16 Correct 0 ms 348 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 1 ms 344 KB Output is correct
19 Correct 0 ms 352 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 1 ms 348 KB Output is correct
4 Correct 2 ms 348 KB Output is correct
5 Correct 1 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 1 ms 344 KB Output is correct
8 Correct 2 ms 604 KB Output is correct
9 Correct 5 ms 860 KB Output is correct
10 Correct 1 ms 348 KB Output is correct
11 Correct 1 ms 392 KB Output is correct
12 Correct 1 ms 348 KB Output is correct
13 Correct 7 ms 1272 KB Output is correct
14 Correct 7 ms 1368 KB Output is correct
15 Correct 7 ms 1112 KB Output is correct
16 Correct 7 ms 1372 KB Output is correct
17 Correct 0 ms 348 KB Output is correct
18 Correct 0 ms 348 KB Output is correct
19 Correct 0 ms 348 KB Output is correct
20 Correct 12 ms 2140 KB Output is correct
21 Correct 2 ms 604 KB Output is correct
22 Correct 1 ms 348 KB Output is correct
23 Correct 16 ms 2672 KB Output is correct
24 Correct 26 ms 4180 KB Output is correct
25 Correct 26 ms 4432 KB Output is correct
26 Correct 13 ms 2404 KB Output is correct
27 Correct 9 ms 1884 KB Output is correct
28 Correct 6 ms 1364 KB Output is correct
29 Correct 29 ms 4856 KB Output is correct
30 Correct 29 ms 4680 KB Output is correct
31 Correct 29 ms 4700 KB Output is correct
32 Correct 28 ms 4440 KB Output is correct
33 Correct 14 ms 2396 KB Output is correct
34 Correct 7 ms 1368 KB Output is correct
35 Correct 0 ms 348 KB Output is correct
36 Correct 0 ms 348 KB Output is correct
37 Correct 1 ms 344 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Incorrect 1 ms 344 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 436 KB Output is correct
3 Incorrect 0 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 436 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Incorrect 0 ms 348 KB Output isn't correct
5 Halted 0 ms 0 KB -