Submission #725548

#TimeUsernameProblemLanguageResultExecution timeMemory
725548SanguineChameleonMars (APIO22_mars)C++17
0 / 100
1 ms456 KiB
#include "mars.h" #include <bits/stdc++.h> using namespace std; string process(vector<vector<string>> a, int cur_i, int cur_j, int cur_k, int n) { if (n == 1) { const vector<int> dx = {1, -1, 0, 0}; const vector<int> dy = {0, 0, 1, -1}; vector<vector<bool>> flag(3); for (int i = 0; i < 3; i++) { flag[i].resize(3); } int cnt = 0; for (int i = 0; i < 3; i++) { for (int j = 0; j < 3; j++) { if (!flag[i][j] && a[i][j][0] == '1') { flag[i][j] = true; deque<pair<int, int>> q = {{i, j}}; cnt++; while (!q.empty()) { int cx = q.front().first; int cy = q.front().second; q.pop_front(); for (int k = 0; k < 4; k++) { int nx = cx + dx[k]; int ny = cy + dy[k]; if (0 <= nx && nx < 3 && 0 <= ny && ny < 3 && a[nx][ny][0] == '1' && !flag[nx][ny]) { flag[nx][ny] = true; q.push_back({nx, ny}); } } } } } } string res; while (cnt) { res += (char)('0' + (cnt & 1)); cnt >>= 1; } res.resize(100, '0'); return res; } assert(false); }
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...