답안 #508702

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
508702 2022-01-13T15:08:38 Z David_M Sajam (COCI18_sajam) C++17
45 / 90
142 ms 1500 KB
#include <bits/stdc++.h>
#define ll long long
#define F first
#define S second
#define all(x) (x).begin(), (x).end()
#define pii pair<int, int>
#define FF first.first
#define FS first.second
#define pb push_back
using namespace std;
const ll N=1000006, INF=1e18, P=998244353;

ll q=1, n, m, x, y, c, l, r, k, a[N], f[N], ansl, ansr, ans, o, u, Ans;
string s;
bitset<1000> b[1000];
int xorr(bitset<1000> x, bitset<1000> y){return min((int)(x^y).count(), (int)(n-(x^y).count()));}

main(){ios_base::sync_with_stdio(false), cin.tie(0);

	cin>>n>>k;
    Ans=INF;
    for (int i=0; i<n; i++){
        cin>>s;
        int j=0;
        for(auto c:s)b[i][j++]=(c=='x');
    }
    for (int i=0; i<n; i++){
        for (int j=0; j<n; j++)ans+=xorr(b[i],b[j]);
        Ans=min(ans, Ans);ans=0;
    }

	puts((Ans<=k) ? "DA":"NE");

}
/*
3 2
xxo
xox
oxx
*/

Compilation message

sajam.cpp:18:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   18 | main(){ios_base::sync_with_stdio(false), cin.tie(0);
      | ^~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 324 KB Output is correct
2 Correct 23 ms 440 KB Output is correct
3 Correct 38 ms 644 KB Output is correct
4 Correct 107 ms 772 KB Output is correct
5 Correct 39 ms 640 KB Output is correct
6 Correct 19 ms 588 KB Output is correct
7 Correct 35 ms 616 KB Output is correct
8 Correct 127 ms 752 KB Output is correct
9 Correct 8 ms 408 KB Output is correct
10 Correct 121 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 2 ms 332 KB Output is correct
3 Incorrect 2 ms 332 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 74 ms 680 KB Output is correct
2 Correct 96 ms 1088 KB Output is correct
3 Correct 62 ms 844 KB Output is correct
4 Correct 52 ms 700 KB Output is correct
5 Correct 103 ms 1224 KB Output is correct
6 Correct 40 ms 588 KB Output is correct
7 Correct 101 ms 844 KB Output is correct
8 Correct 79 ms 972 KB Output is correct
9 Correct 21 ms 460 KB Output is correct
10 Correct 132 ms 1388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 103 ms 748 KB Output is correct
2 Correct 103 ms 1140 KB Output is correct
3 Correct 55 ms 716 KB Output is correct
4 Correct 70 ms 932 KB Output is correct
5 Correct 74 ms 972 KB Output is correct
6 Correct 120 ms 1348 KB Output is correct
7 Correct 30 ms 588 KB Output is correct
8 Correct 73 ms 964 KB Output is correct
9 Correct 81 ms 964 KB Output is correct
10 Correct 135 ms 1388 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 704 KB Output is correct
2 Correct 79 ms 804 KB Output is correct
3 Incorrect 128 ms 1344 KB Output isn't correct
4 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 142 ms 756 KB Output is correct
2 Correct 141 ms 1500 KB Output is correct
3 Incorrect 125 ms 1276 KB Output isn't correct
4 Halted 0 ms 0 KB -