Submission #743377

#TimeUsernameProblemLanguageResultExecution timeMemory
743377saayan007Hexagonal Territory (APIO21_hexagon)C++17
0 / 100
1 ms212 KiB
/* #include "hexagon.h" */ #include "bits/stdc++.h" using namespace std; #define fr first #define sc second #define eb emplace_back #define nl '\n'; int draw_territory(int N, int A, int B, vector<int> D, vector<int> L) { int sz = 10; int dist[sz + 2][sz + 2]; for(int i = 0; i < sz + 2; ++i) for(int j = 0; j < sz + 2; ++j) if(i > 0 && i <= sz && j > 0 && j <= sz) dist[i][j] = -1; else dist[i][j] = 0; dist[sz/2][sz/2] = 0; queue<pair<int, int>> q; q.emplace(sz/2, sz/2); while(!q.empty()) { int x = q.front().fr, y = q.front().sc; q.pop(); for(int dx : {-1, 0, 1}) for(int dy : {-1, 0, 1}) if(dx * dy != 1) { int nx = x + dx, ny = y + dy; if(dist[nx][ny] == -1) { dist[nx][ny] = dist[x][y] + 1; q.emplace(nx, ny); } } } /* for(int i = 1; i <= sz; ++i) { */ /* for(int j = 1; j <= sz; ++j) { */ /* cout << dist[i][j] << ' '; */ /* } */ /* cout << nl; */ /* } */ /* cout << "INPUT" << nl; */ /* cout << N << ' ' << A << ' ' << B << nl; */ /* for(int i = 0; i < N; ++i) { */ /* cout << D[i] << ' ' << L[i] << nl; */ /* } */ /* for(int i = 0; i < N; ++i) { */ /* --D[i]; */ /* if(D[i] >= 3) D[i] = 8 - D[i]; */ /* } */ int x = L[0] - 1; return A*x*(x + 1)*(x + 2) / 3; }
#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...