Submission #97455

# Submission time Handle Problem Language Result Execution time Memory
97455 2019-02-16T09:48:03 Z KLPP Sajam (COCI18_sajam) C++14
15 / 90
5000 ms 3256 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];
	int arr[n][n];
	for(int i=0;i<n;i++){
		cin>>table[i];
	}
	int ans=1000000000;
	for(int i=0;i<n;i++){
		int can=0;
		for(int j=0;j<n;j++)can+=diff(table[i],table[j]);
		ans=min(ans,can);
	}
	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:19:6: warning: unused variable 'arr' [-Wunused-variable]
  int arr[n][n];
      ^~~
# Verdict Execution time Memory Grader output
1 Correct 4 ms 384 KB Output is correct
2 Correct 143 ms 768 KB Output is correct
3 Correct 208 ms 1244 KB Output is correct
4 Correct 1006 ms 2264 KB Output is correct
5 Correct 200 ms 1272 KB Output is correct
6 Correct 83 ms 640 KB Output is correct
7 Correct 713 ms 1124 KB Output is correct
8 Correct 4717 ms 2116 KB Output is correct
9 Correct 74 ms 384 KB Output is correct
10 Correct 4836 ms 2176 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3 ms 384 KB Output is correct
2 Correct 4 ms 384 KB Output is correct
3 Incorrect 5 ms 256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 584 ms 1664 KB Output is correct
2 Correct 754 ms 1912 KB Output is correct
3 Correct 430 ms 1500 KB Output is correct
4 Correct 317 ms 1400 KB Output is correct
5 Correct 1035 ms 2036 KB Output is correct
6 Correct 279 ms 1152 KB Output is correct
7 Correct 573 ms 1656 KB Output is correct
8 Correct 618 ms 1756 KB Output is correct
9 Correct 429 ms 640 KB Output is correct
10 Execution timed out 5035 ms 3192 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 840 ms 2140 KB Output is correct
2 Correct 1044 ms 2040 KB Output is correct
3 Correct 379 ms 1528 KB Output is correct
4 Correct 587 ms 1536 KB Output is correct
5 Correct 768 ms 1656 KB Output is correct
6 Correct 1398 ms 3168 KB Output is correct
7 Correct 158 ms 860 KB Output is correct
8 Correct 666 ms 1668 KB Output is correct
9 Correct 2577 ms 1656 KB Output is correct
10 Execution timed out 5031 ms 3192 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 391 ms 1444 KB Output is correct
2 Correct 384 ms 1528 KB Output is correct
3 Incorrect 1463 ms 3256 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1650 ms 3192 KB Output is correct
2 Correct 1425 ms 3160 KB Output is correct
3 Incorrect 1139 ms 2136 KB Output isn't correct
4 Halted 0 ms 0 KB -