답안 #739125

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
739125 2023-05-10T02:48:05 Z PixelCat 화성 (APIO22_mars) C++17
14 / 100
16 ms 2236 KB
#include "mars.h"
#ifdef NYAOWO
#include "grader.cpp"
#endif

#include <bits/stdc++.h>
#define For(i, a, b) for(int i = a; i <= b; i++)
#define Forr(i, a, b) for(int i = a; i >= b; i--)
#define F first
#define S second
#define sz(x) ((int)x.size())
#define all(x) x.begin(), x.end()
#define eb emplace_back
using namespace std;
using LL = long long;
using pii = pair<int, int>;

int solve(string s, int len) {
    vector<vector<char>> g(len, vector<char>(len));
    For(i, 0, len - 1) For(j, 0, len - 1) {
        g[i][j] = s[i * len + j];
    }
    int cnt_cc = 0;
    const int dx[4] = {0, 0, 1, -1};
    const int dy[4] = {1, -1, 0, 0};
    For(i, 0, len - 1) For(j, 0, len - 1) if(g[i][j] == '1') {
        cnt_cc++;
        queue<pii> que;
        g[i][j] = '0';
        que.emplace(i, j);
        while(!que.empty()) {
            int x, y; tie(x, y) = que.front(); que.pop();
            For(it, 0, 3) {
                int nx = x + dx[it];
                int ny = y + dy[it];
                if(nx < 0 || ny < 0 || nx >= len || ny >= len) continue;
                if(g[nx][ny] != '1') continue;
                g[nx][ny] = '0';
                que.emplace(nx, ny);
            }
        }
    }
    return cnt_cc;
}

string process(vector<vector<string>> a, int I, int J, int k, int n) {
    int len = k * 2 + 3;
    string res;
    For(i, 0, 99) res.push_back('0');
    int l2 = k * 2 + 1;
    For(i, 0, 2) For(j, 0, 2) {
        For(i2, 0, l2 - 1) For(j2, 0, l2 - 1) {
            res[(i + i2) * len + (j + j2)] = a[i][j][i2 * l2 + j2];
        }
    }
    if(k == n - 1) {
        int ans = solve(res, len);
        For(i, 0, 99) res[i] = '0';
        For(i, 0, 10) res[i] = (char)('0' + ((ans & (1 << i)) != 0));
    }
    return res;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1804 KB Output is correct
2 Correct 7 ms 2144 KB Output is correct
3 Correct 8 ms 1872 KB Output is correct
4 Correct 7 ms 2132 KB Output is correct
5 Correct 7 ms 2096 KB Output is correct
6 Correct 8 ms 2236 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1804 KB Output is correct
2 Correct 7 ms 2144 KB Output is correct
3 Correct 8 ms 1872 KB Output is correct
4 Correct 7 ms 2132 KB Output is correct
5 Correct 7 ms 2096 KB Output is correct
6 Correct 8 ms 2236 KB Output is correct
7 Correct 9 ms 2152 KB Output is correct
8 Correct 16 ms 1948 KB Output is correct
9 Correct 16 ms 1980 KB Output is correct
10 Correct 16 ms 1988 KB Output is correct
11 Correct 16 ms 2040 KB Output is correct
12 Correct 16 ms 2024 KB Output is correct
13 Correct 16 ms 2088 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1804 KB Output is correct
2 Correct 7 ms 2144 KB Output is correct
3 Correct 8 ms 1872 KB Output is correct
4 Correct 7 ms 2132 KB Output is correct
5 Correct 7 ms 2096 KB Output is correct
6 Correct 8 ms 2236 KB Output is correct
7 Correct 9 ms 2152 KB Output is correct
8 Correct 16 ms 1948 KB Output is correct
9 Correct 16 ms 1980 KB Output is correct
10 Correct 16 ms 1988 KB Output is correct
11 Correct 16 ms 2040 KB Output is correct
12 Correct 16 ms 2024 KB Output is correct
13 Correct 16 ms 2088 KB Output is correct
14 Incorrect 4 ms 320 KB Incorrect
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1804 KB Output is correct
2 Correct 7 ms 2144 KB Output is correct
3 Correct 8 ms 1872 KB Output is correct
4 Correct 7 ms 2132 KB Output is correct
5 Correct 7 ms 2096 KB Output is correct
6 Correct 8 ms 2236 KB Output is correct
7 Correct 9 ms 2152 KB Output is correct
8 Correct 16 ms 1948 KB Output is correct
9 Correct 16 ms 1980 KB Output is correct
10 Correct 16 ms 1988 KB Output is correct
11 Correct 16 ms 2040 KB Output is correct
12 Correct 16 ms 2024 KB Output is correct
13 Correct 16 ms 2088 KB Output is correct
14 Incorrect 4 ms 320 KB Incorrect
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1804 KB Output is correct
2 Correct 7 ms 2144 KB Output is correct
3 Correct 8 ms 1872 KB Output is correct
4 Correct 7 ms 2132 KB Output is correct
5 Correct 7 ms 2096 KB Output is correct
6 Correct 8 ms 2236 KB Output is correct
7 Correct 9 ms 2152 KB Output is correct
8 Correct 16 ms 1948 KB Output is correct
9 Correct 16 ms 1980 KB Output is correct
10 Correct 16 ms 1988 KB Output is correct
11 Correct 16 ms 2040 KB Output is correct
12 Correct 16 ms 2024 KB Output is correct
13 Correct 16 ms 2088 KB Output is correct
14 Incorrect 4 ms 320 KB Incorrect
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1804 KB Output is correct
2 Correct 7 ms 2144 KB Output is correct
3 Correct 8 ms 1872 KB Output is correct
4 Correct 7 ms 2132 KB Output is correct
5 Correct 7 ms 2096 KB Output is correct
6 Correct 8 ms 2236 KB Output is correct
7 Correct 9 ms 2152 KB Output is correct
8 Correct 16 ms 1948 KB Output is correct
9 Correct 16 ms 1980 KB Output is correct
10 Correct 16 ms 1988 KB Output is correct
11 Correct 16 ms 2040 KB Output is correct
12 Correct 16 ms 2024 KB Output is correct
13 Correct 16 ms 2088 KB Output is correct
14 Incorrect 4 ms 320 KB Incorrect
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1804 KB Output is correct
2 Correct 7 ms 2144 KB Output is correct
3 Correct 8 ms 1872 KB Output is correct
4 Correct 7 ms 2132 KB Output is correct
5 Correct 7 ms 2096 KB Output is correct
6 Correct 8 ms 2236 KB Output is correct
7 Correct 9 ms 2152 KB Output is correct
8 Correct 16 ms 1948 KB Output is correct
9 Correct 16 ms 1980 KB Output is correct
10 Correct 16 ms 1988 KB Output is correct
11 Correct 16 ms 2040 KB Output is correct
12 Correct 16 ms 2024 KB Output is correct
13 Correct 16 ms 2088 KB Output is correct
14 Incorrect 4 ms 320 KB Incorrect
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1804 KB Output is correct
2 Correct 7 ms 2144 KB Output is correct
3 Correct 8 ms 1872 KB Output is correct
4 Correct 7 ms 2132 KB Output is correct
5 Correct 7 ms 2096 KB Output is correct
6 Correct 8 ms 2236 KB Output is correct
7 Correct 9 ms 2152 KB Output is correct
8 Correct 16 ms 1948 KB Output is correct
9 Correct 16 ms 1980 KB Output is correct
10 Correct 16 ms 1988 KB Output is correct
11 Correct 16 ms 2040 KB Output is correct
12 Correct 16 ms 2024 KB Output is correct
13 Correct 16 ms 2088 KB Output is correct
14 Incorrect 4 ms 320 KB Incorrect
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1804 KB Output is correct
2 Correct 7 ms 2144 KB Output is correct
3 Correct 8 ms 1872 KB Output is correct
4 Correct 7 ms 2132 KB Output is correct
5 Correct 7 ms 2096 KB Output is correct
6 Correct 8 ms 2236 KB Output is correct
7 Correct 9 ms 2152 KB Output is correct
8 Correct 16 ms 1948 KB Output is correct
9 Correct 16 ms 1980 KB Output is correct
10 Correct 16 ms 1988 KB Output is correct
11 Correct 16 ms 2040 KB Output is correct
12 Correct 16 ms 2024 KB Output is correct
13 Correct 16 ms 2088 KB Output is correct
14 Incorrect 4 ms 320 KB Incorrect
15 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 8 ms 1804 KB Output is correct
2 Correct 7 ms 2144 KB Output is correct
3 Correct 8 ms 1872 KB Output is correct
4 Correct 7 ms 2132 KB Output is correct
5 Correct 7 ms 2096 KB Output is correct
6 Correct 8 ms 2236 KB Output is correct
7 Correct 9 ms 2152 KB Output is correct
8 Correct 16 ms 1948 KB Output is correct
9 Correct 16 ms 1980 KB Output is correct
10 Correct 16 ms 1988 KB Output is correct
11 Correct 16 ms 2040 KB Output is correct
12 Correct 16 ms 2024 KB Output is correct
13 Correct 16 ms 2088 KB Output is correct
14 Incorrect 4 ms 320 KB Incorrect
15 Halted 0 ms 0 KB -