Submission #982677

#TimeUsernameProblemLanguageResultExecution timeMemory
982677vjudge1Mars (APIO22_mars)C++17
0 / 100
0 ms428 KiB
#include "mars.h" #include <bits/stdc++.h> using namespace std; using ll = long long; using vll = vector <ll>; string process(vector <vector <string> > a, int i, int j, int k, int n) { n = 2*n+1; if (k == 0) { if (i != 2 && j != 2) return a[0][0]; string ans(100, '0'); for (ll ii = 0; ii < 3; ii++) { for (ll jj = 0; jj < 3; jj++) { ans[3*ii+jj] = a[ii][jj][0]; } } return ans; } vector <vector <char> > mat(n, vector <char> (n, false)); for (ll ii = 0; ii < 2; ii++) { for (ll jj = 0; jj < 2; jj++) { mat[ii][jj] = a[ii][jj][0]; } } for (ll th = 0; th < 9; th++) { ll ii = th/3; ll jj = th%3; mat[ii][jj+2] = a[0][2][th]; } for (ll th = 0; th < 9; th++) { ll ii = th/3; ll jj = th%3; mat[ii+2][jj] = a[2][0][th]; } for (ll th = 0; th < 9; th++) { ll ii = th/3; ll jj = th%3; mat[ii+2][jj+2] = a[2][2][th]; } // for (ll i = 0; i < n; i++) { // for (ll j = 0; j < n; j++) { // cerr << mat[i][j] << ' '; // } // cerr << endl; // } vector <vector <char> > vis(n, vector <char> (n, false)); ll ans = 0; for (ll i = 0; i < n; i++) { for (ll j = 0; j < n; j++) { if (mat[i][j] == '0') continue; if (vis[i][j]) continue; ans++; queue <ll> q; q.push(i); q.push(j); while (q.size()) { ll i = q.front(); q.pop(); ll j = q.front(); q.pop(); if (mat[i][j] == '0') continue; if (vis[i][j]) continue; vis[i][j] = true; if (0 < i) { q.push(i-1); q.push(j); } if (i < n-1) { q.push(i+1); q.push(j); } if (0 < j) { q.push(i); q.push(j-1); } if (j < n-1) { q.push(i); q.push(j+1); } } } } string sans(100, '0'); for (ll i = 0; i < 10; i++) { sans[i] = (ans>>i&1 ? '1' : '0'); } return sans; }
#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...