Submission #1045868

# Submission time Handle Problem Language Result Execution time Memory
1045868 2024-08-06T08:13:47 Z 변재우(#11018) Cell Automaton (JOI23_cell) C++17
0 / 100
2 ms 612 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;

const int Nmax=110;
int N, Q, T, ans, A[Nmax][Nmax], B[Nmax][Nmax];

void solve() {
    for(int i=1; i<=101; i++) for(int j=1; j<=101; j++) {
        if(A[i][j]==2) B[i][j]=1;
        else if(A[i][j]==1) B[i][j]=0;
        else {
            if(A[i-1][j]==2 || A[i+1][j]==2 || A[i][j-1]==2 || A[i][j+1]==2) B[i][j]=2;
        }
    }
    ans=0;
    for(int i=1; i<=101; i++) for(int j=1; j<=101; j++) A[i][j]=B[i][j], ans+=(A[i][j]==2);
}

signed main() {
    ios_base::sync_with_stdio(0); cin.tie(0);
    cin>>N>>Q;
    for(int i=1; i<=N; i++) {
        int x, y; cin>>x>>y;
        A[x+51][y+51]=2, ans++;
    }
    while(Q--) {
        int t; cin>>t;
        while(T<t) solve(), T++;
        cout<<ans<<"\n";
    }
    return 0;
}
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 600 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 612 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Runtime error 1 ms 612 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 604 KB Output isn't correct
2 Halted 0 ms 0 KB -