Submission #975952

#TimeUsernameProblemLanguageResultExecution timeMemory
975952phoenix0423Mars (APIO22_mars)C++17
6 / 100
11 ms4552 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; typedef pair<ll, ll> pll; #define fastio ios::sync_with_stdio(false), cin.tie(0) #define pb push_back #define eb emplace_back #define f first #define s second #include "mars.h" int dx[] = {0, 1, 0, -1}; int dy[] = {1, 0, -1, 0}; string solve(string s, int n){ auto inbound = [&](int x, int y) -> bool { return x >= 0 && y >= 0 && x < 2 * n + 1 && y < 2 * n + 1; }; int ans = 0; vector<vector<int>> vis(10, vector<int>(10)); auto dfs = [&](auto dfs, int x, int y) -> void { for(int d = 0; d < 4; d++){ int xx = x + dx[d], yy = y + dy[d]; if(!inbound(xx, yy) || s[xx * 10 + yy] == '0' || vis[xx][yy]) continue; vis[xx][yy] = 1; dfs(dfs, xx, yy); } }; for(int i = 0; i < 10; i++){ for(int j = 0; j < 10; j++){ if(s[i * 10 + j] == '0' || vis[i][j]) continue; ans++; vis[i][j] = 1; dfs(dfs, i, j); } } string ret = ""; for(int i = 0; i < 30; i++){ if(ans & (1 << i)) ret += '1'; else ret += '0'; } for(int i = 0; i < 70; i++) ret += '0'; return ret; } std::string process(std::vector <std::vector<std::string>> a, int i, int j, int k, int n){ if(n <= 4){ vector<vector<int>> st(10, vector<int>(10)); for(int dx = 0; dx < 3; dx++){ for(int dy = 0; dy < 3; dy++){ for(int c = 0; c < 10; c++){ for(int d = 0; d < 10; d++){ if(i + dx + c > 2 * n || j + dy + d > 2 * n) break; if(a[dx][dy][c * 10 + d] == '1') st[dx + c][dy + d] = 1; } } } } a[i][j] = ""; for(int c = 0; c < 10; c++){ for(int d = 0; d < 10; d++){ if(st[c][d]) a[i][j] += '1'; else a[i][j] += '0'; } } if(i == 0 && j == 0 && k == n - 1){ return solve(a[0][0], n); } return a[i][j]; } }

Compilation message (stderr)

mars.cpp: In function 'std::string process(std::vector<std::vector<std::__cxx11::basic_string<char> > >, int, int, int, int)':
mars.cpp:70:1: warning: control reaches end of non-void function [-Wreturn-type]
   70 | }
      | ^
#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...