Submission #512503

#TimeUsernameProblemLanguageResultExecution timeMemory
512503wildturtleSajam (COCI18_sajam)C++14
90 / 90
292 ms3172 KiB
#include<bits/stdc++.h> #define ll long long #define f first #define sc second #define pb push_back using namespace std; ll a,b,c,d,i,e,f,g,n,m,k,l,minn; bitset<1000> A[1000]; string s[1003]; ll xorr(bitset<1000> x, bitset<1000> y){return min((ll)(x^y).count(), (ll)(n-(x^y).count()));} ll go(ll x) { ll cur=0; for(ll i=1;i<=n;i++) { if(i==x) continue; cur+=xorr(A[i],A[x]); } return cur; } int main() { cin>>n>>k; for(ll i=1;i<=n;i++) { cin>>s[i]; for(ll j=0;j<s[i].size();j++) { A[i][j]=(s[i][j]=='x'); } } minn=1e18; for(ll i=1;i<=n;i++) { minn=min(minn,go(i)); } if(n==k) { for(ll j=0;j<n;j++) { if(A[1][j]==0) A[1][j]=1; else A[1][j]=0; minn=min(minn,go(1)+1); if(A[1][j]==0) A[1][j]=1; else A[1][j]=0; } } if(minn<=k) cout<<"DA"; else cout<<"NE"; }

Compilation message (stderr)

sajam.cpp: In function 'int main()':
sajam.cpp:23:21: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 |         for(ll j=0;j<s[i].size();j++) {
      |                    ~^~~~~~~~~~~~
#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...