Submission #1063960

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
10639602024-08-18 06:48:04thinknoexitMars (APIO22_mars)C++17
6 / 100
8 ms3176 KiB
#include "mars.h"
#include<bits/stdc++.h>
using namespace std;
using ll = long long;
int di[4] = { 1, 0, -1, 0 }, dj[4] = { 0, 1, 0, -1 };
// n <= 2
string count_island(int n, vector<string> v) {
vector<vector<bool>> vis(n, vector<bool>(n, false));
function<void(int, int)> dfs;
dfs = [&](int i, int j) {
vis[i][j] = 1;
for (int k = 0;k < 4;k++) {
int ii = i + di[k], jj = j + dj[k];
if (ii < 0 || jj < 0 || ii >= n || jj >= n) continue;
if (vis[ii][jj] || v[ii][jj] == '0') continue;
dfs(ii, jj);
}
};
int cnt = 0;
for (int i = 0;i < n;i++) {
for (int j = 0;j < n;j++) {
if (!vis[i][j] && v[i][j] == '1') {
cnt++;
dfs(i, j);
}
}
}
string s = string(100, '0');
for (int j = 0;j < 10;j++) {
s[j] = ((cnt >> j) & 1) + '0';
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#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...