Submission #1063911

# Submission time Handle Problem Language Result Execution time Memory
1063911 2024-08-18T06:03:15 Z kunzaZa183 Hexagonal Territory (APIO21_hexagon) C++17
0 / 100
1 ms 348 KB
#include "hexagon.h"

#include <bits/stdc++.h>
#include <cstdint>
using namespace std;
#define int long long

int32_t draw_territory(int32_t N, int32_t A, int32_t B, vector<int32_t> D,
                       vector<int32_t> L) {

  const int mod = 1e9 + 7;
  int step = L[0];
  step %= mod;
  int numoftrig = (L[0] + 1) * (L[0] + 2) / 2 % mod;

  function<int(int, int)> logpow = [&](int a, int b) {
    if (b == 0)
      return 1LL;
    int x = logpow(a, b / 2);
    if (b % 2 == 1)
      return x * x % mod * a % mod;
    return x * x % mod;
  };

  int coefd = (step + 1) * (step + 2) % mod * (2 * step + 3) % mod *
              logpow(6, mod - 2) % mod;
  coefd -= numoftrig;
  coefd += mod;
  coefd %= mod;

  return (coefd * B + A * numoftrig) % mod;
}
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -