Submission #199844

# Submission time Handle Problem Language Result Execution time Memory
199844 2020-02-03T16:31:00 Z zoooma13 Sajam (COCI18_sajam) C++14
90 / 90
209 ms 632 KB
#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

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 time Memory Grader output
1 Correct 5 ms 256 KB Output is correct
2 Correct 30 ms 376 KB Output is correct
3 Correct 40 ms 376 KB Output is correct
4 Correct 111 ms 376 KB Output is correct
5 Correct 40 ms 376 KB Output is correct
6 Correct 18 ms 376 KB Output is correct
7 Correct 37 ms 376 KB Output is correct
8 Correct 118 ms 632 KB Output is correct
9 Correct 11 ms 376 KB Output is correct
10 Correct 116 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 424 KB Output is correct
2 Correct 6 ms 256 KB Output is correct
3 Correct 6 ms 376 KB Output is correct
4 Correct 5 ms 256 KB Output is correct
5 Correct 5 ms 256 KB Output is correct
6 Correct 94 ms 400 KB Output is correct
7 Correct 6 ms 504 KB Output is correct
8 Correct 5 ms 256 KB Output is correct
9 Correct 6 ms 376 KB Output is correct
10 Correct 6 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 83 ms 376 KB Output is correct
2 Correct 96 ms 428 KB Output is correct
3 Correct 70 ms 376 KB Output is correct
4 Correct 61 ms 400 KB Output is correct
5 Correct 107 ms 504 KB Output is correct
6 Correct 43 ms 376 KB Output is correct
7 Correct 78 ms 504 KB Output is correct
8 Correct 80 ms 376 KB Output is correct
9 Correct 25 ms 376 KB Output is correct
10 Correct 132 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 101 ms 376 KB Output is correct
2 Correct 102 ms 376 KB Output is correct
3 Correct 58 ms 376 KB Output is correct
4 Correct 76 ms 452 KB Output is correct
5 Correct 84 ms 376 KB Output is correct
6 Correct 127 ms 376 KB Output is correct
7 Correct 34 ms 376 KB Output is correct
8 Correct 77 ms 448 KB Output is correct
9 Correct 81 ms 376 KB Output is correct
10 Correct 130 ms 484 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 88 ms 376 KB Output is correct
2 Correct 101 ms 504 KB Output is correct
3 Correct 200 ms 376 KB Output is correct
4 Correct 64 ms 380 KB Output is correct
5 Correct 89 ms 504 KB Output is correct
6 Correct 209 ms 608 KB Output is correct
7 Correct 65 ms 376 KB Output is correct
8 Correct 67 ms 376 KB Output is correct
9 Correct 69 ms 376 KB Output is correct
10 Correct 66 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 202 ms 504 KB Output is correct
2 Correct 191 ms 376 KB Output is correct
3 Correct 177 ms 504 KB Output is correct
4 Correct 105 ms 376 KB Output is correct
5 Correct 105 ms 376 KB Output is correct
6 Correct 121 ms 456 KB Output is correct
7 Correct 63 ms 432 KB Output is correct
8 Correct 156 ms 376 KB Output is correct
9 Correct 85 ms 504 KB Output is correct
10 Correct 186 ms 376 KB Output is correct