Submission #508714

#TimeUsernameProblemLanguageResultExecution timeMemory
508714David_MSajam (COCI18_sajam)C++17
90 / 90
252 ms1328 KiB
#include <bits/stdc++.h> #define ll long long #define F first #define S second #define all(x) (x).begin(), (x).end() #define pii pair<int, int> #define FF first.first #define FS first.second #define pb push_back using namespace std; const ll N=1000006, INF=1e9, P=998244353; int q=1, n, m, x, y, c, l, r, k, a[N], f[N], ansl, ansr, ans, o, u, Ans; string s; bitset<1000> b[1000]; int xorr(bitset<1000> x, bitset<1000> y){return min((int)(x^y).count(), (int)(n-(x^y).count()));} int solve(int i){ int ans=0; for (int j=0; j<n; j++)ans+=xorr(b[i],b[j]); return ans; } main(){ios_base::sync_with_stdio(false), cin.tie(0); cin>>n>>k; Ans=INF; for (int i=0; i<n; i++){ cin>>s; int j=0; for(auto c:s)b[i][j++]=(c=='x'); } for (int i=0; i<n; i++)Ans=min(solve(i), Ans); if(k==n){ for (int i=0; i<n; i++){ b[0][i].flip(); Ans=min(solve(0)+1, Ans); b[0][i].flip(); } } puts((Ans<=k) ? "DA":"NE"); } /* 3 2 xxo xox oxx */

Compilation message (stderr)

sajam.cpp:22:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   22 | main(){ios_base::sync_with_stdio(false), cin.tie(0);
      | ^~~~
#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...