Submission #799808

#TimeUsernameProblemLanguageResultExecution timeMemory
799808Trisanu_DasSajam (COCI18_sajam)C++17
90 / 90
105 ms3284 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\n"; 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\n"; return 0; } b[0][i].flip(); } cout << "NE\n"; }
#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...