제출 #821125

#제출 시각아이디문제언어결과실행 시간메모리
821125HanksburgerMars (APIO22_mars)C++17
14 / 100
10 ms2228 KiB
#include "mars.h" #include <bits/stdc++.h> using namespace std; string process(vector<vector<string> > a, int i, int j, int k, int n) { if (i<2*(n-k-1) && j==2*(n-k-1)) { a[0][0][1]=a[0][1][0]; for (int i=0; i<=2*k; i++) a[0][0][i+2]=a[0][2][i]; } else if (i==2*(n-k-1) && j<2*(n-k-1)) { a[0][0][1]=a[1][0][0]; for (int i=0; i<=2*k; i++) a[0][0][i+2]=a[2][0][i]; } else if (i==2*(n-k-1) && j==2*(n-k-1)) { a[0][0][1]=a[0][1][0]; for (int i=0; i<=2*k; i++) a[0][0][i+2]=a[0][2][i]; a[0][0][2*k+3]=a[1][0][0]; a[0][0][2*k+4]=a[1][1][0]; for (int i=0; i<=2*k; i++) a[0][0][i+2*k+5]=a[1][2][i]; int ind=4*k+6; for (int i=0; i<=2*k; i++) { a[0][0][ind]=a[2][0][i]; a[0][0][ind+1]=a[2][1][i]; for (int j=0; j<=2*k; j++) a[0][0][j+ind+2]=a[2][2][i*(2*k+1)+j]; ind+=2*k+3; } } if (k==n-1) { int visited[45][45], ans=0; for (int i=0; i<=2*n; i++) for (int j=0; j<=2*n; j++) visited[i][j]=0; pair<int, int> adj[4]={{1, 0}, {-1, 0}, {0, 1}, {0, -1}}; queue<pair<int, int> > q; for (int i=0; i<=2*n; i++) { for (int j=0; j<=2*n; j++) { if (a[0][0][i*(2*n+1)+j]=='1' && !visited[i][j]) { ans++; visited[i][j]=1; q.push({i, j}); while (!q.empty()) { int ui=q.front().first, uj=q.front().second; q.pop(); for (int l=0; l<4; l++) { int vi=ui+adj[l].first, vj=uj+adj[l].second; if (0<=vi && vi<=2*n && 0<=vj && vj<=2*n && a[0][0][vi*(2*n+1)+vj]=='1' && !visited[vi][vj]) { visited[vi][vj]=1; q.push({vi, vj}); } } } } } } for (int i=0; i<10; i++) a[0][0][i]='0'+(bool)(ans&(1<<i)); for (int i=10; i<100; i++) a[0][0][i]='0'; } return a[0][0]; }
#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...