답안 #870813

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
870813 2023-11-09T08:03:31 Z vjudge1 Sajam (COCI18_sajam) C++17
15 / 90
11 ms 2416 KB
//author: Ahmet Alp Orakci
#include <bits/stdc++.h>
using namespace std;
using i64 = long long;

const int MAXN = 1E3 + 5;

char matrix[MAXN][MAXN];

#define ONLINE_JUDGE
void solve() {
    memset(matrix, 'x', sizeof(matrix));

    int n, k;
    cin >> n >> k;
    
    for(int i = 1; i <= n; i++) {
        for(int j = 1; j <= n; j++) {
            cin >> matrix[i][j];
        }
    }

    auto reversex = [&](int x) -> void {
        for(int i = 1; i <= n; i++) {
            matrix[x][i] = (matrix[x][i] == 'o' ? 'x' : 'o');
        }
    };

    for(int i = 1; i <= n -1; i++) {
        if(matrix[i][1] != matrix[i +1][1]) {
            reversex(i +1);
        }
    }

    bool ans = true;
    for(int i = 1; i <= n -1; i++) {
        for(int j = 1; j <= n; j++) {
            ans &= matrix[i][j] == matrix[i +1][j];
        }
    }

    cout << (ans ? "DA" : "NE");
    
    return;
}

signed main() {
    #ifndef ONLINE_JUDGE
        freopen(".in", "r", stdin);
        freopen(".out", "w", stdout);
    #endif

    ios_base::sync_with_stdio(false);
    cin.tie(NULL); cout.tie(NULL);

    int t = 1; //cin >> t;
    for(int i = 1; i <= t; i++) {
        solve();
    }

    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1372 KB Output is correct
2 Correct 2 ms 1628 KB Output is correct
3 Correct 3 ms 1628 KB Output is correct
4 Correct 11 ms 2072 KB Output is correct
5 Correct 3 ms 1628 KB Output is correct
6 Correct 2 ms 1456 KB Output is correct
7 Correct 3 ms 1560 KB Output is correct
8 Correct 10 ms 2292 KB Output is correct
9 Correct 2 ms 1372 KB Output is correct
10 Correct 9 ms 2136 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 1372 KB Output is correct
2 Incorrect 1 ms 1372 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1884 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 8 ms 2140 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 1716 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 2416 KB Output isn't correct
2 Halted 0 ms 0 KB -