Submission #200586

# Submission time Handle Problem Language Result Execution time Memory
200586 2020-02-07T13:07:52 Z Asrapogorgon Sajam (COCI18_sajam) C++14
45 / 90
345 ms 644 KB
#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define pb push_back
#define int long long 
const int maxn=2e3+5;
/*Almost copy pasted part :)*/
bitset <maxn> bit[maxn];
#define YES "DA"
#define NO "NE"
int32_t main(){
    int n,k;
    cin>>n>>k;
    for(int i=0;i<n;i++){
        for(int j=0;j<n;j++){
            char t;
            cin>>t;
            bit[i][j]=(t=='x');
        }
    }
    for(int i=0;i<n;i++){
        int cnt=0;
        for(int j=0;j<n;j++){
            int z=(bit[i]^bit[j]).count();
            cnt+=min(z,n-z);
        }
        if(cnt<=k){
            cout<<YES<<endl;
            return 0;
        }
    }
    bitset<maxn> b = bit[0];
    for(int i=0;i<n;i++){
        int cnt=0;
        for(int j=0;j<n;j++){
            int cn=(bit[j]^b).count();
            cn=min(cn,n-cn);
            cnt+=cn;
        }  
        if(cnt<=k){
            cout<<YES<<endl;
            return 0;
        }
        b[i]=(1-b[i]);
    }   
    cout<<NO<<endl;
}
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 21 ms 376 KB Output is correct
3 Correct 28 ms 504 KB Output is correct
4 Correct 79 ms 504 KB Output is correct
5 Correct 30 ms 376 KB Output is correct
6 Correct 15 ms 376 KB Output is correct
7 Correct 93 ms 524 KB Output is correct
8 Correct 328 ms 632 KB Output is correct
9 Correct 24 ms 376 KB Output is correct
10 Correct 309 ms 500 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Incorrect 8 ms 424 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 57 ms 480 KB Output is correct
2 Correct 66 ms 504 KB Output is correct
3 Correct 51 ms 504 KB Output is correct
4 Correct 43 ms 504 KB Output is correct
5 Correct 77 ms 504 KB Output is correct
6 Correct 128 ms 500 KB Output is correct
7 Correct 206 ms 504 KB Output is correct
8 Correct 220 ms 504 KB Output is correct
9 Correct 60 ms 376 KB Output is correct
10 Correct 342 ms 632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 71 ms 504 KB Output is correct
2 Correct 70 ms 504 KB Output is correct
3 Correct 42 ms 508 KB Output is correct
4 Correct 53 ms 504 KB Output is correct
5 Correct 56 ms 504 KB Output is correct
6 Correct 340 ms 608 KB Output is correct
7 Correct 81 ms 504 KB Output is correct
8 Correct 185 ms 504 KB Output is correct
9 Correct 210 ms 504 KB Output is correct
10 Correct 335 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 43 ms 632 KB Output is correct
2 Correct 43 ms 504 KB Output is correct
3 Incorrect 345 ms 632 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 93 ms 504 KB Output is correct
2 Correct 90 ms 644 KB Output is correct
3 Incorrect 316 ms 600 KB Output isn't correct
4 Halted 0 ms 0 KB -