Submission #376328

# Submission time Handle Problem Language Result Execution time Memory
376328 2021-03-11T08:42:19 Z lyc Selotejp (COCI20_selotejp) C++14
0 / 110
1 ms 492 KB
#include <bits/stdc++.h>
using namespace std;

#define TRACE(x) cerr << #x << " :: " << x << endl
#define _ << " " <<
#define SZ(x) (int)(x).size()
#define ALL(x) (x).begin(),(x).end()
#define FOR(i,a,b) for(int i=(a);i<=(b);++i)
#define RFOR(i,a,b) for (int i=(a);i>=(b);--i)

const int mxN = 1000;
const int mxM = 10;

int N, M;
string G[mxN];

int main() {
    ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);

    cin >> N >> M;
    int corner = 0, ed = 0;
    int dy[] = {-1,0,1,0};
    int dx[] = {0,1,0,-1};
    FOR(i,0,N-1){
        cin >> G[i];
    }

    FOR(i,0,N-1){
        FOR(j,0,M-1) if (G[i][j] == '#') {
            int c = 0;
            int d[] = {0,0};
            FOR(k,0,3){
                int a = i+dy[k], b = j+dx[k];
                if (a >= 0 && a < N && b >= 0 && b < M && G[a][b] == '#') {
                    d[c++] = k;
                }
            }
            if (c == 1) ++ed;
            else if (c == 2 && (d[0]-d[1])%2 != 0) ++corner;
        }
    }

    cout << corner + ed/2 << '\n';
}

# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 364 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 492 KB Output isn't correct
2 Halted 0 ms 0 KB -