제출 #1202133

#제출 시각아이디문제언어결과실행 시간메모리
1202133adiyer화성 (APIO22_mars)C++20
0 / 100
0 ms3376 KiB
#include <bits/stdc++.h> using namespace std; int was[10000]; int arr[100][100]; vector < int > g[100]; void dfs(int v){ was[v] = 1; for(int u : g[v]) if(!was[u]) dfs(u); } string process(vector < vector < string > > a, int i, int j, int k, int n){ string s; for(int x = 0; x < 3; x++){ for(int y = 0; y < 3; y++){ if(i + x < 2 * (n - k - 1) && j + y < 2 * (n - k - 1)){ while(a[x][y].size() > 1) a[x][y].pop_back(); } else if(i + x >= 2 * (n - k - 1) && j + y >= (2 * (n - k - 1))){ while(a[x][y].size() > (2 * k + 1) * (2 * k + 1)) a[x][y].pop_back(); } else{ while(a[x][y].size() > (2 * k + 1)) a[x][y].pop_back(); } } } if(i < 2 * (n - k - 1) && j < 2 * (n - k - 1)){ s = a[0][0]; } else if(i < 2 * (n - k - 1)){ s = a[0][0] + a[0][1] + a[2][0]; } else if(j < 2 * (n - k - 1)){ s = a[0][0] + a[1][0] + a[2][0]; } else{ s = a[0][0] + a[0][1] + a[0][2] + a[1][0] + a[1][1] + a[1][2] + a[2][0] + a[2][1] + a[2][2]; } if(k == n - 1){ n = 2 * n + 1; for(int i = 0; i < n; i++) for(int j = 0; j < n; j++) arr[i][j] = s[i * n + j] - '0'; for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ if(!arr[i][j]) continue; int v = i * n + j; if(i > 0 && arr[i - 1][j]) g[v].push_back(v - n); if(j > 0 && arr[i][j - 1]) g[v].push_back(v - 1); if(i < n - 1 && arr[i + 1][j]) g[v].push_back(v + n); if(j < n - 1 && arr[i][j + 1]) g[v].push_back(v + 1); } } int ans = 0; for(int i = 0; i < n * n; i++){ if(!was[i] && arr[i / n][i % n]){ dfs(i), ans++; } } s.clear(); for(int i = 0; i < 30; i++) s.push_back(('0' + (ans >> i & 1))); while(s.size() < 100) s.push_back('0'); reverse(s.begin(), s.end()); return s; } while(s.size() < 100) s.push_back('0'); return s; }
#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...