Submission #97474

# Submission time Handle Problem Language Result Execution time Memory
97474 2019-02-16T11:21:59 Z KLPP Sajam (COCI18_sajam) C++14
0 / 90
3281 ms 5204 KB
#include<bits/stdc++.h>

using namespace std;
typedef long long int lld;

int diff(string a, string b){
	int ans1=0;
	int ans2=0;
	for(int i=0;i<a.size();i++){
		if(a.at(i)!=b.at(i))ans1++;
		else ans2++;
	}
	return min(ans1,ans2);
}
int main(){
	int n,k;
	cin>>n>>k;
	string table[n];
	string table2[n];
	int arr[n][n];
	for(int i=0;i<n;i++){
		cin>>table[i];
		for(int j=0;j<n;j++)table2[i]+=table[i].at(j);
		table2[i].at(0)='x'+'o'-table[i].at(0);
		cout<<table2[i]<<endl;
	}
	int ans=1000000000;
	for(int i=0;i<n;i++){
		int can=0;
		int can2=0;
		for(int j=0;j<n;j++){
			can+=diff(table[i],table[j]);
			can2+=diff(table2[i],table[j]);
		}
		ans=min(ans,min(can,can2));
	}
	if(ans<=k)cout<<"DA"<<endl;
	else cout<<"NE"<<endl;
	return 0;
}

Compilation message

sajam.cpp: In function 'int diff(std::__cxx11::string, std::__cxx11::string)':
sajam.cpp:9:15: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int i=0;i<a.size();i++){
              ~^~~~~~~~~
sajam.cpp: In function 'int main()':
sajam.cpp:20:6: warning: unused variable 'arr' [-Wunused-variable]
  int arr[n][n];
      ^~~
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 4 ms 384 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1376 ms 2424 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2128 ms 2824 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 820 ms 2168 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3281 ms 5204 KB Output isn't correct
2 Halted 0 ms 0 KB -