Submission #199843

# Submission time Handle Problem Language Result Execution time Memory
199843 2020-02-03T16:28:10 Z zoooma13 Sajam (COCI18_sajam) C++14
60 / 90
5000 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 ret = INT_MAX;
	for(int i=0; i<n; 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());
			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 376 KB Output is correct
2 Correct 27 ms 376 KB Output is correct
3 Correct 40 ms 376 KB Output is correct
4 Correct 119 ms 376 KB Output is correct
5 Correct 39 ms 376 KB Output is correct
6 Correct 19 ms 376 KB Output is correct
7 Correct 43 ms 376 KB Output is correct
8 Correct 118 ms 480 KB Output is correct
9 Correct 11 ms 376 KB Output is correct
10 Correct 121 ms 504 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 5 ms 376 KB Output is correct
2 Correct 28 ms 256 KB Output is correct
3 Correct 49 ms 376 KB Output is correct
4 Correct 14 ms 376 KB Output is correct
5 Correct 23 ms 256 KB Output is correct
6 Correct 19 ms 256 KB Output is correct
7 Correct 48 ms 380 KB Output is correct
8 Correct 18 ms 256 KB Output is correct
9 Correct 34 ms 376 KB Output is correct
10 Correct 25 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 85 ms 456 KB Output is correct
2 Correct 93 ms 376 KB Output is correct
3 Correct 67 ms 504 KB Output is correct
4 Correct 58 ms 376 KB Output is correct
5 Correct 114 ms 632 KB Output is correct
6 Correct 44 ms 376 KB Output is correct
7 Correct 76 ms 376 KB Output is correct
8 Correct 81 ms 376 KB Output is correct
9 Correct 28 ms 376 KB Output is correct
10 Correct 129 ms 376 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 110 ms 504 KB Output is correct
2 Correct 100 ms 376 KB Output is correct
3 Correct 65 ms 376 KB Output is correct
4 Correct 76 ms 504 KB Output is correct
5 Correct 79 ms 376 KB Output is correct
6 Correct 130 ms 504 KB Output is correct
7 Correct 35 ms 376 KB Output is correct
8 Correct 72 ms 380 KB Output is correct
9 Correct 85 ms 376 KB Output is correct
10 Correct 132 ms 604 KB Output is correct
# Verdict Execution time Memory Grader output
1 Execution timed out 5064 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Execution timed out 5059 ms 376 KB Time limit exceeded
2 Halted 0 ms 0 KB -