# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
786034 | 2023-07-17T22:57:00 Z | yeyso | Mars (APIO22_mars) | C++17 | 8 ms | 2324 KB |
#include "mars.h" #include <bits/stdc++.h> using namespace std; vector<vector<int>> m; vector<vector<int>> v; void dfs(int i, int j, int z){ if(!v[i][j] and m[i][j] != 48){ v[i][j] = z; if(i < m.size() - 1) dfs(i+1, j, z); if(j < m.size() - 1) dfs(i, j+1, z); if(i > 0) dfs(i-1, j, z); if(j > 0) dfs(i, j-1, z); } } string process(vector<vector<string>> a, int i, int j, int k, int n) { if(k == 0){ string z(100, '0'); vector<vector<int>> g(3, vector<int>(3, 0)); v = g; int x = 0; for(int i = 0; i < 3; i ++){ for(int j = 0; j < 3; j ++){ z[x] = a[i][j][0]; g[i][j] = a[i][j][0]; x += 1; } } if(n == 1){ m = g; x = 1; for(int i = 0; i < g.size(); i ++){ for(int j = 0; j < g[i].size(); j ++){ //cout << g[i][j] << " "; dfs(i, j, x); x += 1; } //cout << "\n"; } set<int> is; for(int i = 0; i < v.size(); i ++){ for(int j = 0; j < v[i].size(); j ++){ is.insert(v[i][j]); } } string res = bitset<100>(is.size() - 1).to_string(); reverse(res.begin(), res.end()); return res; } return z; } if(n == 2) if(k == 1){ //cout << "hi"; vector<vector<int>> grid(5, vector<int>(5, 0)); v = grid; int x = 0; for(int i = 0; i < 3; i ++){ for(int j = 0; j < 3; j ++){ grid[i][j] = a[0][0][x]; x += 1; } } x = 0; for(int i = 0; i < 3; i ++){ for(int j = 2; j < 5; j ++){ grid[i][j] = a[0][2][x]; x += 1; } } x = 0; for(int i = 2; i < 5; i ++){ for(int j = 0; j < 3; j ++){ grid[i][j] = a[2][0][x]; x += 1; } } x = 0; for(int i = 2; i < 5; i ++){ for(int j = 2; j < 5; j ++){ grid[i][j] = a[2][2][x]; x += 1; } } m = grid; x = 1; for(int i = 0; i < grid.size(); i ++){ for(int j = 0; j < grid[i].size(); j ++){ //cout << grid[i][j] << " "; dfs(i, j, x); x += 1; } //cout << "\n"; } set<int> is; for(int i = 0; i < v.size(); i ++){ for(int j = 0; j < v[i].size(); j ++){ //cout << v[i][j] << " "; is.insert(v[i][j]); } //cout << "\n"; } string res = bitset<100>(is.size() - 1).to_string(); reverse(res.begin(), res.end()); return res; } return std::string(100 ,'0'); } /* g++ -Wall -lm -static -DEVAL -o mars -O2 mars.cpp grader.cpp -std=c++17 1 2 1 1 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 0 0 0 1 0 1 1 1 1 1 1 1 0 1 1 0 1 0 1 1 0 1 0 1 */
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2036 KB | Output is correct |
2 | Correct | 4 ms | 2068 KB | Output is correct |
3 | Correct | 7 ms | 2028 KB | Output is correct |
4 | Correct | 8 ms | 2044 KB | Output is correct |
5 | Correct | 6 ms | 1880 KB | Output is correct |
6 | Correct | 4 ms | 2324 KB | Output is correct |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2036 KB | Output is correct |
2 | Correct | 4 ms | 2068 KB | Output is correct |
3 | Correct | 7 ms | 2028 KB | Output is correct |
4 | Correct | 8 ms | 2044 KB | Output is correct |
5 | Correct | 6 ms | 1880 KB | Output is correct |
6 | Correct | 4 ms | 2324 KB | Output is correct |
7 | Incorrect | 1 ms | 200 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2036 KB | Output is correct |
2 | Correct | 4 ms | 2068 KB | Output is correct |
3 | Correct | 7 ms | 2028 KB | Output is correct |
4 | Correct | 8 ms | 2044 KB | Output is correct |
5 | Correct | 6 ms | 1880 KB | Output is correct |
6 | Correct | 4 ms | 2324 KB | Output is correct |
7 | Incorrect | 1 ms | 200 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2036 KB | Output is correct |
2 | Correct | 4 ms | 2068 KB | Output is correct |
3 | Correct | 7 ms | 2028 KB | Output is correct |
4 | Correct | 8 ms | 2044 KB | Output is correct |
5 | Correct | 6 ms | 1880 KB | Output is correct |
6 | Correct | 4 ms | 2324 KB | Output is correct |
7 | Incorrect | 1 ms | 200 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2036 KB | Output is correct |
2 | Correct | 4 ms | 2068 KB | Output is correct |
3 | Correct | 7 ms | 2028 KB | Output is correct |
4 | Correct | 8 ms | 2044 KB | Output is correct |
5 | Correct | 6 ms | 1880 KB | Output is correct |
6 | Correct | 4 ms | 2324 KB | Output is correct |
7 | Incorrect | 1 ms | 200 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2036 KB | Output is correct |
2 | Correct | 4 ms | 2068 KB | Output is correct |
3 | Correct | 7 ms | 2028 KB | Output is correct |
4 | Correct | 8 ms | 2044 KB | Output is correct |
5 | Correct | 6 ms | 1880 KB | Output is correct |
6 | Correct | 4 ms | 2324 KB | Output is correct |
7 | Incorrect | 1 ms | 200 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2036 KB | Output is correct |
2 | Correct | 4 ms | 2068 KB | Output is correct |
3 | Correct | 7 ms | 2028 KB | Output is correct |
4 | Correct | 8 ms | 2044 KB | Output is correct |
5 | Correct | 6 ms | 1880 KB | Output is correct |
6 | Correct | 4 ms | 2324 KB | Output is correct |
7 | Incorrect | 1 ms | 200 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2036 KB | Output is correct |
2 | Correct | 4 ms | 2068 KB | Output is correct |
3 | Correct | 7 ms | 2028 KB | Output is correct |
4 | Correct | 8 ms | 2044 KB | Output is correct |
5 | Correct | 6 ms | 1880 KB | Output is correct |
6 | Correct | 4 ms | 2324 KB | Output is correct |
7 | Incorrect | 1 ms | 200 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2036 KB | Output is correct |
2 | Correct | 4 ms | 2068 KB | Output is correct |
3 | Correct | 7 ms | 2028 KB | Output is correct |
4 | Correct | 8 ms | 2044 KB | Output is correct |
5 | Correct | 6 ms | 1880 KB | Output is correct |
6 | Correct | 4 ms | 2324 KB | Output is correct |
7 | Incorrect | 1 ms | 200 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 2036 KB | Output is correct |
2 | Correct | 4 ms | 2068 KB | Output is correct |
3 | Correct | 7 ms | 2028 KB | Output is correct |
4 | Correct | 8 ms | 2044 KB | Output is correct |
5 | Correct | 6 ms | 1880 KB | Output is correct |
6 | Correct | 4 ms | 2324 KB | Output is correct |
7 | Incorrect | 1 ms | 200 KB | Incorrect |
8 | Halted | 0 ms | 0 KB | - |