답안 #385875

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
385875 2021-04-05T07:17:31 Z AdiZer0 Sajam (COCI18_sajam) C++17
90 / 90
2877 ms 5356 KB
#include <bits/stdc++.h>

#define pb push_back
#define whole(x) x.begin(), x.end()
#define sz(x) (int)x.size()

using namespace std;

typedef long long ll;
typedef long double ld;

const int N = (int)1e5 + 7;
const int INF = (int)1e9 + 7;
const ll linf = (ll)1e18 + 1;

int a[1005][1005];

int main() {
    int n, k; cin >> n >> k;
    for (int i = 1; i <= n; ++i) { 
        for (int j = 1; j <= n; ++j) {
            char ch; cin >> ch;
            a[i][j] = (ch == 'x') ? 1 : 0;
        }
    } 
    for (int turn = 1; turn <= n; ++turn) { 
        for (int i = 1; i <= n; ++i) { 
            int cnt = 0;
            for (int j = 1; j <= n; ++j) cnt += (a[i][j] == 0);
            if (2 * cnt > n) { 
                for (int j = 1; j <= n; ++j) a[i][j] = (a[i][j] ^ 1);
            }
        }
        for (int j = 1; j <= n; ++j) { 
            int cnt = 0;
            for (int i = 1; i <= n; ++i) cnt += (a[i][j] == 0);
            if (2 * cnt > n) { 
                for (int i = 1; i <= n; ++i) a[i][j] = (a[i][j] ^ 1);
            }
        }
        int kol = 0;
        for (int i = 1; i <= n; ++i) { 
            for (int j = 1; j <= n; ++j) kol += a[i][j];
        }
        if (n * n - kol <= k) return cout << "DA\n", 0;
    }
    cout << "NE\n";
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 13 ms 2156 KB Output is correct
3 Correct 19 ms 2668 KB Output is correct
4 Correct 57 ms 4844 KB Output is correct
5 Correct 20 ms 2668 KB Output is correct
6 Correct 9 ms 1644 KB Output is correct
7 Correct 344 ms 2576 KB Output is correct
8 Correct 2432 ms 4896 KB Output is correct
9 Correct 35 ms 1260 KB Output is correct
10 Correct 2454 ms 4940 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 492 KB Output is correct
2 Correct 2 ms 620 KB Output is correct
3 Correct 2 ms 620 KB Output is correct
4 Correct 1 ms 492 KB Output is correct
5 Correct 1 ms 620 KB Output is correct
6 Correct 2 ms 620 KB Output is correct
7 Correct 4 ms 748 KB Output is correct
8 Correct 2 ms 492 KB Output is correct
9 Correct 3 ms 620 KB Output is correct
10 Correct 3 ms 620 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 39 ms 3820 KB Output is correct
2 Correct 48 ms 4332 KB Output is correct
3 Correct 33 ms 3436 KB Output is correct
4 Correct 29 ms 3180 KB Output is correct
5 Correct 56 ms 4716 KB Output is correct
6 Correct 444 ms 2924 KB Output is correct
7 Correct 1181 ms 3852 KB Output is correct
8 Correct 1325 ms 4076 KB Output is correct
9 Correct 190 ms 2028 KB Output is correct
10 Correct 2831 ms 5248 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 51 ms 4460 KB Output is correct
2 Correct 57 ms 4460 KB Output is correct
3 Correct 30 ms 3308 KB Output is correct
4 Correct 37 ms 3692 KB Output is correct
5 Correct 40 ms 3948 KB Output is correct
6 Correct 2826 ms 5116 KB Output is correct
7 Correct 305 ms 2412 KB Output is correct
8 Correct 1146 ms 3820 KB Output is correct
9 Correct 1248 ms 3932 KB Output is correct
10 Correct 2877 ms 5356 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 29 ms 3308 KB Output is correct
2 Correct 30 ms 3308 KB Output is correct
3 Correct 67 ms 5100 KB Output is correct
4 Correct 22 ms 2796 KB Output is correct
5 Correct 32 ms 3308 KB Output is correct
6 Correct 2610 ms 5100 KB Output is correct
7 Correct 418 ms 2832 KB Output is correct
8 Correct 502 ms 2924 KB Output is correct
9 Correct 538 ms 3052 KB Output is correct
10 Correct 496 ms 2924 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 76 ms 5356 KB Output is correct
2 Correct 71 ms 5100 KB Output is correct
3 Correct 59 ms 4844 KB Output is correct
4 Correct 37 ms 3692 KB Output is correct
5 Correct 37 ms 3692 KB Output is correct
6 Correct 1239 ms 4076 KB Output is correct
7 Correct 460 ms 2924 KB Output is correct
8 Correct 1928 ms 4716 KB Output is correct
9 Correct 738 ms 3436 KB Output is correct
10 Correct 2644 ms 5100 KB Output is correct