Submission #934682

# Submission time Handle Problem Language Result Execution time Memory
934682 2024-02-27T19:22:48 Z MinaRagy06 Hexagonal Territory (APIO21_hexagon) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#ifdef MINA
#include "grader.cpp"
#endif
#include "hexagon.h"
using namespace std;
#define ll long long

const int mod = 1e9 + 7;
int draw_territory(int n, int a, int b, vector<int> d, vector<int> l) {
	ll sz = l[0] + 1;
	ll v1 = 1ll * sz * (sz + 1) / 2 % mod * a % mod;

	v2 = 0;
	if ((sz - 1) % 3 == 0) {
		v2 = (sz - 1) / 3;
		v2 = 1ll * v2 * sz % mod * (sz + 1) % mod;
	} else if (sz % 3 == 0) {
		v2 = sz / 3;
		v2 = 1ll * v2 * (sz - 1) % mod * (sz + 1) % mod;
	} else {
		v2 = (sz + 1) / 3;
		v2 = 1ll * v2 * (sz - 1) % mod * sz % mod;
	}
	v2 = 1ll * v2 * b % mod;
	return (v1 + v2) % mod;
}

Compilation message

hexagon.cpp: In function 'int draw_territory(int, int, int, std::vector<int>, std::vector<int>)':
hexagon.cpp:14:2: error: 'v2' was not declared in this scope; did you mean 'v1'?
   14 |  v2 = 0;
      |  ^~
      |  v1