답안 #1063800

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
1063800 2024-08-18T03:23:07 Z thinknoexit 육각형 영역 (APIO21_hexagon) C++17
9 / 100
1 ms 600 KB
#include "hexagon.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
const ll MOD = 1e9 + 7;
ll A, B;
ll mop(ll a, ll p) {
    ll ans = 1;
    for (;p != 0ll;p >>= 1ll, a = a * a % MOD) {
        if (p & 1ll) ans = ans * a % MOD;
    }
    return ans;
}
int draw_territory(int N, int AA, int BB, vector<int> D, vector<int> L) {
    // N = 3
    A = AA, B = BB;
    ll l = L[0];
    // triangle with l + 1 level
    ll cnt = (l + 1) * (l + 2) / 2;
    cnt %= MOD;
    ll res = cnt * A % MOD;
    // sum = 1 * 1 - 1 + 2 * 2 - 2 + 3 * 3 - 3 + ... + (l+1) * (l+1) - (l+1)
    // sum = (l+1)(l+2)(2*l+3)/6
    ll sum = (l + 1) * (l + 2) % MOD * (2 * l + 3) % MOD * mop(6, MOD - 2) % MOD;
    sum = (sum - cnt + MOD) % MOD;
    res = (res + sum * B % MOD) % MOD;
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Correct 0 ms 348 KB Output is correct
6 Correct 0 ms 348 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 1 ms 432 KB Output is correct
9 Correct 0 ms 436 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 0 ms 348 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Incorrect 1 ms 348 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 348 KB Output is correct
2 Correct 0 ms 348 KB Output is correct
3 Correct 0 ms 344 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 600 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -