답안 #508709

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
508709 2022-01-13T15:16:23 Z David_M Sajam (COCI18_sajam) C++17
0 / 90
130 ms 452 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;

int 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()));}
int solve(int i){
    int ans=0;
    for (int j=0; j<n; j++)ans+=xorr(b[i],b[j]);
    return ans;
}
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++)Ans=min(solve(i), Ans);
    /*if(k==n){
        for (int i=0; i<n; i++){
            b[0][i].flip();
            Ans=min(solve(0)+1, Ans);
            b[0][i].flip();
        }
    }*/

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

}
/*
3 2
xxo
xox
oxx
*/

Compilation message

sajam.cpp:22:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   22 | main(){ios_base::sync_with_stdio(false), cin.tie(0);
      | ^~~~
sajam.cpp: In function 'int main()':
sajam.cpp:25:9: warning: overflow in conversion from 'long long int' to 'int' changes value from '1000000000000000000' to '-1486618624' [-Woverflow]
   25 |     Ans=INF;
      |         ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 25 ms 332 KB Output is correct
3 Correct 36 ms 332 KB Output is correct
4 Correct 105 ms 432 KB Output is correct
5 Correct 35 ms 332 KB Output is correct
6 Correct 14 ms 332 KB Output is correct
7 Incorrect 32 ms 332 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 332 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 332 KB Output is correct
4 Correct 1 ms 336 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Incorrect 1 ms 332 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 73 ms 404 KB Output is correct
2 Correct 89 ms 412 KB Output is correct
3 Correct 59 ms 332 KB Output is correct
4 Correct 52 ms 332 KB Output is correct
5 Correct 104 ms 332 KB Output is correct
6 Incorrect 36 ms 376 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 96 ms 332 KB Output is correct
2 Correct 106 ms 332 KB Output is correct
3 Correct 56 ms 388 KB Output is correct
4 Correct 67 ms 332 KB Output is correct
5 Correct 71 ms 332 KB Output is correct
6 Incorrect 120 ms 452 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 57 ms 332 KB Output is correct
2 Correct 54 ms 400 KB Output is correct
3 Correct 126 ms 428 KB Output is correct
4 Correct 42 ms 332 KB Output is correct
5 Correct 59 ms 388 KB Output is correct
6 Incorrect 130 ms 432 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 126 ms 428 KB Output is correct
2 Correct 118 ms 436 KB Output is correct
3 Correct 109 ms 332 KB Output is correct
4 Correct 82 ms 332 KB Output is correct
5 Correct 69 ms 332 KB Output is correct
6 Incorrect 71 ms 404 KB Output isn't correct
7 Halted 0 ms 0 KB -