답안 #613885

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
613885 2022-07-30T12:24:59 Z AugustinasJucas 육각형 영역 (APIO21_hexagon) C++14
9 / 100
1 ms 340 KB
#include "hexagon.h"
#include <bits/stdc++.h>

using namespace std;
int n = 0;
const long long mod = 1e9 + 7;
long long pw(long long x, long long y) {
    if(y == 0) return 1;
    auto sq = pw(x, y/2);
    sq = sq * sq % mod;
    if(y & 1) sq = sq * x % mod;
    return sq;
}
long long inv(long long x) {
    return pw(x, mod-2);
}
long long S(long long ind) {
    ind--;
    long long ret = ind*ind%mod*ind%mod;
    ret = (ret + 3ll*ind % mod * ind % mod) % mod;
    ret = (ret + 2ll * ind % mod) % mod;
    ret = ret * inv(3) % mod;
    return ret;
}
int draw_territory(int N, int A, int B,
                   std::vector<int> D, std::vector<int> L) {
    n = N;
    if (n == 3) {
        long long side = (L[0] + 1) % mod;
        long long area = (side * (side + 1) / 2ll) % mod;
      //  cout << "area = " << area << endl;
        long long ret = (area * A % mod + B * S(side) % mod) % mod;
        return ret;
    }


    return 0;
}
/*
3 1 0
1 3
3 3
5 3
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 300 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Correct 1 ms 296 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 1 ms 212 KB Output is correct
8 Correct 1 ms 300 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 0 ms 296 KB Output is correct
11 Correct 0 ms 300 KB Output is correct
12 Correct 0 ms 212 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Incorrect 0 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 340 KB Output is correct
4 Correct 0 ms 304 KB Output is correct
5 Incorrect 0 ms 212 KB Output isn't correct
6 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -