Submission #200588

#TimeUsernameProblemLanguageResultExecution timeMemory
200588AsrapogorgonSajam (COCI18_sajam)C++14
90 / 90
331 ms1652 KiB
#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; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...