| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 1187643 | Aviansh | Hexagonal Territory (APIO21_hexagon) | C++20 | 0 ms | 328 KiB |
#include "hexagon.h"
#include <bits/stdc++.h>
using namespace std;
const int mod = 1e9+7;
long long modinv(long long x){
int need = mod-2;
long long ans = 1;
long long curr = x;
for(int i = 0;i<32;i++){
if((1<<i)&need){
ans*=curr;
ans%=mod;
}
curr*=curr;
curr%=mod;
}
return ans;
}
int draw_territory(int n, int a, int b,vector<int> d, vector<int> l) {
assert(n==3);
assert(l[0]==l[1]&&l[1]==l[2]);
int s = l[0]+1;
long long ans = 1LL*s*(s+1);
ans/=2;
ans%=mod;
ans*=a;
ans%=mod;
s--;
long long bsum = (1LL*s*(s+1))/2;
bsum%=mod;
bsum+=(((((1LL*s*(s+1))%mod)*(2*s+1))%mod)*modinv(6))%mod;
bsum%=mod;
bsum*=b;
bsum%=mod;
ans+=bsum;
ans%=mod;
return ans;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
