답안 #200588

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
200588 2020-02-07T13:11:36 Z Asrapogorgon Sajam (COCI18_sajam) C++14
90 / 90
331 ms 1652 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=='o');
        }
    }
    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++){
        b[i]=(1-b[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;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 380 KB Output is correct
2 Correct 22 ms 376 KB Output is correct
3 Correct 27 ms 376 KB Output is correct
4 Correct 78 ms 504 KB Output is correct
5 Correct 29 ms 504 KB Output is correct
6 Correct 14 ms 376 KB Output is correct
7 Correct 87 ms 376 KB Output is correct
8 Correct 289 ms 504 KB Output is correct
9 Correct 23 ms 504 KB Output is correct
10 Correct 310 ms 504 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 5 ms 376 KB Output is correct
3 Correct 7 ms 376 KB Output is correct
4 Correct 6 ms 376 KB Output is correct
5 Correct 6 ms 376 KB Output is correct
6 Correct 6 ms 376 KB Output is correct
7 Correct 7 ms 380 KB Output is correct
8 Correct 6 ms 376 KB Output is correct
9 Correct 8 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 54 ms 540 KB Output is correct
2 Correct 66 ms 508 KB Output is correct
3 Correct 46 ms 424 KB Output is correct
4 Correct 42 ms 504 KB Output is correct
5 Correct 82 ms 504 KB Output is correct
6 Correct 102 ms 376 KB Output is correct
7 Correct 190 ms 552 KB Output is correct
8 Correct 208 ms 632 KB Output is correct
9 Correct 59 ms 376 KB Output is correct
10 Correct 331 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 72 ms 508 KB Output is correct
2 Correct 70 ms 504 KB Output is correct
3 Correct 44 ms 504 KB Output is correct
4 Correct 55 ms 504 KB Output is correct
5 Correct 55 ms 504 KB Output is correct
6 Correct 317 ms 760 KB Output is correct
7 Correct 84 ms 376 KB Output is correct
8 Correct 176 ms 632 KB Output is correct
9 Correct 193 ms 588 KB Output is correct
10 Correct 326 ms 632 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 504 KB Output is correct
2 Correct 42 ms 504 KB Output is correct
3 Correct 270 ms 504 KB Output is correct
4 Correct 92 ms 760 KB Output is correct
5 Correct 113 ms 888 KB Output is correct
6 Correct 312 ms 1400 KB Output is correct
7 Correct 100 ms 760 KB Output is correct
8 Correct 110 ms 760 KB Output is correct
9 Correct 116 ms 760 KB Output is correct
10 Correct 111 ms 760 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 94 ms 504 KB Output is correct
2 Correct 93 ms 632 KB Output is correct
3 Correct 244 ms 632 KB Output is correct
4 Correct 181 ms 1016 KB Output is correct
5 Correct 123 ms 1072 KB Output is correct
6 Correct 198 ms 1144 KB Output is correct
7 Correct 105 ms 760 KB Output is correct
8 Correct 266 ms 1400 KB Output is correct
9 Correct 139 ms 888 KB Output is correct
10 Correct 307 ms 1652 KB Output is correct