Submission #1225181

#TimeUsernameProblemLanguageResultExecution timeMemory
1225181JerMars (APIO22_mars)C++20
0 / 100
0 ms2900 KiB
#include "mars.h" #include <bits/stdc++.h> using namespace std; string make(vector<vector<string>> a){ string res; for (int i = 0; i < 3; i++) for (int j = 0; j < 3; j++) res.push_back(a[i][j][0]); for (int i = 0; i < 91; i++) res.push_back('0'); return res; } #define in(i, j) i >= 0 and i < 5 and j >= 0 and j < 5 int get(vector<vector<int>> b, int i, int j){ if (!in(i, j)) return -1; return b[i][j]; } #define isn(b, i, j) (get(b, i + 1, j) == 1 or get(b, i, j + 1) == 1 or get(b, i - 1, j) == 1 or get(b, i - 1, j - 1) == 1) int count(vector<vector<int>> b){ int res = 0; for (int i = 0; i < 5; i++) for (int j = 0; j < 5; j++){ if (b[i][j] == 1 and !isn(b, i, j)) res++; if (b[i][j] == 1) b[i][j] = 0; } return res; } string to_binary(int i){ string res; while (i > 0) res.push_back((i % 2 == 0) ? '1' : '0'), i /= 2; res.push_back((i % 2 == 0) ? '1' : '0'); reverse(res.begin(), res.end()); for (int i = 0; i < 100 - res.size(); i++) res.push_back('0'); return res; } std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n) { if (k != n - 1) return make(a); vector<vector<int>> b; b.resize(5); for (auto i : b) i.resize(5); for (int i = 0; i < 9; i++) b[i / 3][i % 3] = a[0][0][i]; for (int i = 0; i < 9; i++) b[i / 3][(i % 3) + 2] = a[0][2][i]; for (int i = 0; i < 9; i++) b[(i / 3) + 2][i % 3] = a[1][0][i]; for (int i = 0; i < 9; i++) b[(i / 3) + 2][(i % 3) + 2] = a[1][2][i]; return to_binary(count(b)); }
#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...