Submission #199844

#TimeUsernameProblemLanguageResultExecution timeMemory
199844zoooma13Sajam (COCI18_sajam)C++14
90 / 90
209 ms632 KiB
#include <bits/stdc++.h> using namespace std; #define MAX_N 1003 int n ,k; bitset <MAX_N> bs[MAX_N]; int lk(int g=n){ int ret = INT_MAX; for(int i=0; i<g; i++){ int toch = 0; for(int j=0; j<n; j++){ int diff = (bs[i]^bs[j]).count(); toch += min(diff, n-diff); } ret = min(ret ,toch); } return ret; } int main() { scanf("%d%d",&n,&k); for(int i=0; i<n; i++) for(int j=0; j<n; j++){ char c; scanf(" %c",&c); bs[i][j] = (c == 'o'); } int mik = lk(); if(k == n){ for(int i=0; i<n; i++){ bs[0][i] = bs[0][i]^1; mik = min(mik ,lk(1)); bs[0][i] = bs[0][i]^1; } } printf(mik <= k ? "DA\n" : "NE\n"); }

Compilation message (stderr)

sajam.cpp: In function 'int main()':
sajam.cpp:23:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&k);
  ~~~~~^~~~~~~~~~~~~~
sajam.cpp:27:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c",&c);
   ~~~~~^~~~~~~~~~
#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...