답안 #508707

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
508707 2022-01-13T15:15:49 Z David_M Sajam (COCI18_sajam) C++17
0 / 90
257 ms 1344 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 33 ms 332 KB Output is correct
4 Correct 111 ms 420 KB Output is correct
5 Correct 38 ms 392 KB Output is correct
6 Correct 18 ms 368 KB Output is correct
7 Incorrect 36 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 2 ms 332 KB Output is correct
3 Correct 3 ms 332 KB Output is correct
4 Correct 1 ms 460 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Incorrect 2 ms 304 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 86 ms 396 KB Output is correct
2 Correct 91 ms 332 KB Output is correct
3 Correct 59 ms 332 KB Output is correct
4 Correct 51 ms 332 KB Output is correct
5 Correct 109 ms 416 KB Output is correct
6 Incorrect 49 ms 332 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 95 ms 332 KB Output is correct
2 Correct 99 ms 416 KB Output is correct
3 Correct 69 ms 392 KB Output is correct
4 Correct 67 ms 336 KB Output is correct
5 Correct 72 ms 332 KB Output is correct
6 Incorrect 120 ms 424 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 109 ms 396 KB Output is correct
2 Correct 104 ms 332 KB Output is correct
3 Correct 242 ms 432 KB Output is correct
4 Correct 75 ms 668 KB Output is correct
5 Correct 115 ms 700 KB Output is correct
6 Incorrect 228 ms 1344 KB Output isn't correct
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 257 ms 444 KB Output is correct
2 Correct 246 ms 332 KB Output is correct
3 Correct 222 ms 424 KB Output is correct
4 Correct 138 ms 916 KB Output is correct
5 Correct 132 ms 924 KB Output is correct
6 Incorrect 144 ms 956 KB Output isn't correct
7 Halted 0 ms 0 KB -