Submission #199819

#TimeUsernameProblemLanguageResultExecution timeMemory
199819mahmoudbadawySajam (COCI18_sajam)C++17
90 / 90
194 ms3232 KiB
#include <bits/stdc++.h> using namespace std; string arr[1005]; bitset<1005> bit[1005]; int co[1005]; int n,k; int main() { cin >> n >> k; for(int i=0;i<n;i++) { cin >> arr[i]; for(int j=0;j<n;j++) { arr[i][j]=(arr[i][j]=='o'?'1':'0'); } bit[i]=bitset<1005>(arr[i]); } for(int i=0;i<n;i++) { int cur=0; for(int j=0;j<n;j++) { int z=(bit[i]^bit[j]).count(); cur+=min(z,n-z); } if(cur<=k) { cout << "DA" << endl; return 0; } } bitset<1005> b=bit[0]; for(int i=0;i<n;i++) { b[i]=(1-b[i]); int cur=0; for(int j=0;j<n;j++) { int z=(b^bit[j]).count(); cur+=min(z,n-z); } if(cur<=k) { cout << "DA" << endl; return 0; } b[i]=(1-b[i]); } cout << "NE" << 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...