Submission #1063913

# Submission time Handle Problem Language Result Execution time Memory
1063913 2024-08-18T06:04:58 Z kunzaZa183 Hexagonal Territory (APIO21_hexagon) C++17
9 / 100
1 ms 604 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];
  int numoftrig = (step + 1) * (step + 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 % mod + A * numoftrig % mod) % mod;
}
# 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 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
# 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 0 ms 348 KB Output is correct
4 Correct 1 ms 436 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 0 ms 344 KB Output is correct
7 Correct 0 ms 348 KB Output is correct
8 Correct 0 ms 348 KB Output is correct
9 Correct 0 ms 348 KB Output is correct
10 Correct 0 ms 348 KB Output is correct
11 Correct 1 ms 344 KB Output is correct
12 Correct 0 ms 348 KB Output is correct
# 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 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 440 KB Output is correct
3 Incorrect 0 ms 432 KB Output isn't correct
4 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 Correct 0 ms 348 KB Output is correct
2 Correct 0 ms 604 KB Output is correct
3 Correct 0 ms 348 KB Output is correct
4 Correct 0 ms 348 KB Output is correct
5 Incorrect 0 ms 432 KB Output isn't correct
6 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 -