Submission #199820

#TimeUsernameProblemLanguageResultExecution timeMemory
199820mohammedehab2002Sajam (COCI18_sajam)C++11
90 / 90
199 ms2424 KiB
#include <bits/stdc++.h> using namespace std; int n,k; string s[1005]; bitset<1005> b[1005]; int get(int i,int j) { int cnt=(b[i]^b[j]).count(); return min(cnt,n-cnt); } int main() { cin >> n >> k; for (int i=0;i<n;i++) { cin >> s[i]; for (int j=0;j<n;j++) b[i][j]=(s[i][j]=='o'); } for (int i=0;i<n;i++) { int cur=0; for (int j=0;j<n;j++) cur+=get(i,j); if (cur<=k) { cout << "DA"; return 0; } } for (int i=0;i<n;i++) { b[0][i].flip(); int cur=0; for (int j=0;j<n;j++) cur+=get(0,j); if (cur<=k) { cout << "DA"; return 0; } b[0][i].flip(); } cout << "NE"; }
#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...