Submission #556676

#TimeUsernameProblemLanguageResultExecution timeMemory
556676josanneo22Hexagonal Territory (APIO21_hexagon)C++17
3 / 100
1528 ms340 KiB
#include "hexagon.h" #include <vector> #include<bits/stdc++.h> #include<iostream> #include<cmath> #include<stdlib.h> using namespace std; typedef long long ll; typedef pair<int, int> pii; typedef vector<int> vi; typedef vector<vi> vvi; typedef vector<pair<int, int> > vpii; typedef pair<ll,ll> pll; typedef vector<ll> vll; #define FOR(i,a,b) for (int i = (a); i < (b); ++i) #define F0R(i,a) FOR(i,0,a) #define ROF(i,a,b) for (int i = (b); i > (a); --i) #define R0F(i,a) ROF(i,0,a) #define trav(a,x) for (auto& a: x) #define mp make_pair #define pb push_back #define rsz resize #define sz(x) int(x.size()) #define all(x) (x).begin(), (x).end() #define f first #define s second #define out(x) cout<<x; #define in(x) cin>>x; #define inarr(a,x,y) for(int i=x;i<y;i++){cin>>a[i];} #define incor(a,x,y) for(int i=x;i<y;i++){cin>>a[i].f>>a[i].s;} int dx[4] = { -1, 0, 1, 0 }; int dy[4] = { 0, 1, 0, -1 }; const int mod = 1e9 + 7; int draw_territory(int N, int A, int B, std::vector<int> D, std::vector<int> L) { ll ans = ((((L[0] + 1) * 1LL * (L[0] + 2)) / 2) % mod); ans *= A; ans %= mod; if(B!=0) { FOR(i,0,L[0] + 1) { ans += (((i * (i + 1)) % mod) * B) % mod; ans %= mod; } } sort(all(L)); assert(L[0] == L.back()); return ans; }
#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...