Submission #97475

# Submission time Handle Problem Language Result Execution time Memory
97475 2019-02-16T11:22:40 Z KLPP Sajam (COCI18_sajam) C++14
30 / 90
5000 ms 4976 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 Correct 3 ms 384 KB Output is correct
2 Correct 245 ms 888 KB Output is correct
3 Correct 503 ms 1444 KB Output is correct
4 Correct 2157 ms 2268 KB Output is correct
5 Correct 351 ms 1500 KB Output is correct
6 Correct 96 ms 640 KB Output is correct
7 Correct 1508 ms 1372 KB Output is correct
8 Execution timed out 5004 ms 2168 KB Time limit exceeded
9 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 4 ms 256 KB Output is correct
2 Correct 5 ms 384 KB Output is correct
3 Correct 7 ms 432 KB Output is correct
4 Correct 4 ms 356 KB Output is correct
5 Correct 1 ms 356 KB Output is correct
6 Correct 4 ms 384 KB Output is correct
7 Correct 6 ms 384 KB Output is correct
8 Correct 3 ms 256 KB Output is correct
9 Correct 7 ms 384 KB Output is correct
10 Correct 2 ms 384 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1366 ms 1832 KB Output is correct
2 Correct 1682 ms 2040 KB Output is correct
3 Correct 1081 ms 1708 KB Output is correct
4 Correct 931 ms 1604 KB Output is correct
5 Correct 2468 ms 2268 KB Output is correct
6 Correct 468 ms 1408 KB Output is correct
7 Correct 1346 ms 1936 KB Output is correct
8 Correct 1378 ms 1912 KB Output is correct
9 Correct 732 ms 888 KB Output is correct
10 Execution timed out 5074 ms 4088 KB Time limit exceeded
# Verdict Execution time Memory Grader output
1 Correct 1895 ms 2076 KB Output is correct
2 Correct 1984 ms 2040 KB Output is correct
3 Correct 784 ms 1656 KB Output is correct
4 Correct 1191 ms 1784 KB Output is correct
5 Correct 1337 ms 1912 KB Output is correct
6 Correct 2549 ms 4080 KB Output is correct
7 Correct 293 ms 888 KB Output is correct
8 Correct 1192 ms 1780 KB Output is correct
9 Execution timed out 5012 ms 1784 KB Time limit exceeded
10 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 856 ms 1664 KB Output is correct
2 Correct 972 ms 1756 KB Output is correct
3 Correct 3242 ms 4156 KB Output is correct
4 Correct 527 ms 1708 KB Output is correct
5 Correct 801 ms 2040 KB Output is correct
6 Correct 2587 ms 4976 KB Output is correct
7 Correct 400 ms 1784 KB Output is correct
8 Correct 546 ms 1884 KB Output is correct
9 Correct 2201 ms 1812 KB Output is correct
10 Correct 2045 ms 1756 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 3246 ms 4204 KB Output is correct
2 Correct 2516 ms 4088 KB Output is correct
3 Correct 2328 ms 2296 KB Output is correct
4 Correct 1145 ms 2296 KB Output is correct
5 Correct 1143 ms 2296 KB Output is correct
6 Correct 1292 ms 2296 KB Output is correct
7 Correct 565 ms 1756 KB Output is correct
8 Correct 2087 ms 2908 KB Output is correct
9 Correct 3221 ms 2140 KB Output is correct
10 Execution timed out 5017 ms 3064 KB Time limit exceeded