Submission #1080949

#TimeUsernameProblemLanguageResultExecution timeMemory
1080949pawnedHexagonal Territory (APIO21_hexagon)C++17
0 / 100
1 ms348 KiB
#pragma GCC optimize("O1,O2,O3,Ofast,unroll-loops") #include <bits/stdc++.h> using namespace std; #define fi first #define se second #define pb push_back typedef long long ll; typedef pair<int, int> ii; typedef vector<int> vi; #include "hexagon.h" const ll MOD = 1e9 + 7; ll nr(ll x) { x %= MOD; x += MOD; x %= MOD; return x; } ll binpow(ll x, ll y) { x = nr(x); ll res = 1; while (y > 0) { if (y % 2 == 1) res = nr(res * x); x = nr(x * x); y /= 2; } return res; } ll inv(ll x) { return binpow(x, MOD - 2); } int N; ll A, B; vi D, L; int draw_territory(int N_g, int A_g, int B_g, vector<int> D_g, vector<int> L_g) { N = N_g; A = A_g; B = B_g; for (int x : D_g) D.pb(x); for (int x : L_g) L.pb(x); ll x1 = nr(nr((L[0] + 1) * (L[0] + 2)) * inv(2)); ll x2 = nr(nr(nr((L[0] + 1) * (L[0] + 2)) * (L[0] + 3)) * inv(3)); return nr(x1 * A + x2 * B); }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...