Submission #1225237

#TimeUsernameProblemLanguageResultExecution timeMemory
1225237JerMars (APIO22_mars)C++20
0 / 100
0 ms3276 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; } int get(vector<vector<int>> b, int i, int j){ if (i < 0 or j < 0 or i >= 5 or j >= 5) 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 x){ string res; while (x > 0) res.push_back(x % 2 + '0'), x /= 2; res.push_back(x % 2 + '0'); while (res.size() < 100) 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(6); for (int i = 0; i < 6; i++) b[i].resize(6); for (int i = 0; i < 9; i++) b[i / 3][i % 3] = a[0][0][i] - '0'; for (int i = 0; i < 9; i++) b[i / 3][(i % 3) + 2] = a[0][2][i] - '0'; for (int i = 0; i < 9; i++) b[(i / 3) + 2][i % 3] = a[2][0][i] - '0'; for (int i = 0; i < 9; i++) b[(i / 3) + 2][(i % 3) + 2] = a[2][2][i] - '0'; 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...