# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
199844 | zoooma13 | Sajam (COCI18_sajam) | C++14 | 209 ms | 632 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <bits/stdc++.h>
using namespace std;
#define MAX_N 1003
int n ,k;
bitset <MAX_N> bs[MAX_N];
int lk(int g=n){
int ret = INT_MAX;
for(int i=0; i<g; i++){
int toch = 0;
for(int j=0; j<n; j++){
int diff = (bs[i]^bs[j]).count();
toch += min(diff, n-diff);
}
ret = min(ret ,toch);
}
return ret;
}
int main()
{
scanf("%d%d",&n,&k);
for(int i=0; i<n; i++)
for(int j=0; j<n; j++){
char c;
scanf(" %c",&c);
bs[i][j] = (c == 'o');
}
int mik = lk();
if(k == n){
for(int i=0; i<n; i++){
bs[0][i] = bs[0][i]^1;
mik = min(mik ,lk(1));
bs[0][i] = bs[0][i]^1;
}
}
printf(mik <= k ? "DA\n" : "NE\n");
}
Compilation message (stderr)
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |