Submission #567083

#TimeUsernameProblemLanguageResultExecution timeMemory
567083Bill_00Hexagonal Territory (APIO21_hexagon)C++14
0 / 100
1 ms300 KiB
#include "hexagon.h" #include <bits/stdc++.h> #include <vector> typedef long long ll; const ll MOD = 1000000007; const ll low = -1000000000; using namespace std; ll area, bound, x, y; int draw_territory(int N, int A, int B, vector<int> D, vector<int> L){ if(B == 0){ for(int i = 0; i < N; i++){ ll val = L[i]; bound += val; bound %= MOD; if(D[i] == 1){ y += val; } if(D[i] == 2){ area += ((2 * y * val) % MOD); area = area % MOD; x += val; } if(D[i] == 3){ area += (((2 * y - val) * val) % MOD); area = area % MOD; x += val; y -= val; } if(D[i] == 4){ y -= val; } if(D[i] == 5){ area -= ((2 * y * val) % MOD); area = (area % MOD + MOD) % MOD; x -= val; } if(D[i] == 6){ area -= (((2 * y + val) * val) % MOD); area = (area % MOD + MOD) % MOD; x -= val; y += val; } } // cout << area << "\n"; if(area < 0) area = (MOD - (area % MOD)) % MOD; // if(area != (L[0] * L[0])) while(1); // cout << area << '\n'; ll inter = (area + 2 - bound); inter = (inter % MOD + MOD) % MOD; if(inter % 2 == 1) inter = (inter + MOD) / 2; else inter /= 2; inter %= MOD; ll a = A; return ((((inter + bound) % MOD) * a) % MOD); } return 0; }
#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...