CSES - Datatähti 2020 alku - Results
Submission details
Task:Merkkijonot
Sender:Kurns
Submission time:2019-10-01 21:21:47 +0300
Language:C++ (C++11)
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.01 s1, 2, 3details
#20.01 s2, 3details
#30.16 s3details
#40.21 s3details
#50.06 s3details
#60.01 s1, 2, 3details
#70.01 s1, 2, 3details
#80.01 s1, 2, 3details
#90.01 s1, 2, 3details
#100.01 s2, 3details
#110.01 s2, 3details
#120.01 s2, 3details
#130.01 s2, 3details
#140.01 s2, 3details
#150.16 s3details
#160.16 s3details
#170.16 s3details
#180.16 s3details
#190.16 s3details
#200.01 s1, 2, 3details
#210.01 s1, 2, 3details
#220.01 s1, 2, 3details
#230.01 s1, 2, 3details
#240.01 s1, 2, 3details

Compiler report

input/code.cpp: In function 'bool harmoninen(std::__cxx11::string, std::__cxx11::string)':
input/code.cpp:42:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int a = 0; a < s1.length(); a++) {
                  ~~^~~~~~~~~~~~~
input/code.cpp:51:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < s1.length(); i++) {
                  ~~^~~~~~~~~~~~~

Code

#include <iostream>
#include <vector>
#include <string>
#include <map>
#include <algorithm>

using namespace std;

vector<string> sanat; //Lista sanoista

bool harmoninen(string s1, string s2) {
	//if (s1.length() != s2.length()) return false;
	string uusi = "";
	map<char, char> vastaavat; //A->S, B->G eli ekan kirjain -> tokan vastaava
	map<char, bool> used; //Lista toisen sanan kaytetyista
	used['A'] = false;
	used['B'] = false;
	used['C'] = false;
	used['D'] = false;
	used['E'] = false;
	used['F'] = false;
	used['G'] = false;
	used['H'] = false;
	used['I'] = false;
	used['J'] = false;
	used['K'] = false;
	used['L'] = false;
	used['M'] = false;
	used['N'] = false;
	used['O'] = false;
	used['P'] = false;
	used['Q'] = false;
	used['R'] = false;
	used['S'] = false;
	used['T'] = false;
	used['U'] = false;
	used['V'] = false;
	used['W'] = false;
	used['X'] = false;
	used['Y'] = false;
	used['Z'] = false;
	for (int a = 0; a < s1.length(); a++) {
		if (vastaavat.count(s1[a]) > 0 && vastaavat[s1[a]] == s2[a]) continue;
		else if (used[s2[a]] == false) {
			vastaavat[s1[a]] = s2[a];
			used[s2[a]] = true;
		}
		else return false;
	}

	for (int i = 0; i < s1.length(); i++) {
		uusi += vastaavat[s1[i]];
	}

	if (uusi == s2) {
		return true;
	}
	else {
		return false;
	}
}

bool lengthSort(string eka, string toka) {
	return eka.length() < toka.length();
}

int main()
{
	int lkm;
	cin >> lkm;
	for (int i = 0; i < lkm; i++) {
		string ip;
		cin >> ip;
		sanat.push_back(ip);
	}

	sort(sanat.begin(), sanat.end(), lengthSort);
/*
	//for (auto a : sanat) {
		//cout << a << endl;
	//}

	int tulos = 0; //Lopputulos
	int k = 0;
	while (k < lkm-1) { //Looppaa listan
		int e = k + 1;
		while (e < lkm) { //Toinen looppi
			if (sanat[e].length() > sanat[k].length()) e = lkm-1; //E loppuun
			if (harmoninen(sanat[k], sanat[e])) { //Jos harmoniset
				//cout << "FOUND" << endl;
				tulos++;
			}
			e++;
		}
		k++;
	}
*/
	cout << "k";
}

Test details

Test 1

Group: 1, 2, 3

Verdict:

input
20
FFDISOVJLPIASANJRBHQXJVW
HBGVRZFWOTAAVUPYKMKXAOBEYUE
JKHXTPHUKTLTLNXMXMSYYFLF
HCSZMXTZCUFHIHSTEWKHCFZRTXU
...

correct output
20

user output
k

Test 2

Group: 2, 3

Verdict:

input
5000
AJEDROEDXRGDUSDAPZBXXQBPJ
PDGCTAGCRTBCJICPFELRRMLFD
TISAOTGMDKUCITIEFQVCSBZJYUUO
FMASVJYFPMELSVLQWFZVLVMSPHYL
...

correct output
2178556

user output
k

Test 3

Group: 3

Verdict:

input
100000
RESKYADLVRSDCDXJVECAJCAP
CZLIWDHKVNRJHZINHFBOQEPN
LSTRSDTLADUIWXFQJSQPVRSPBCTZ
QEMSZOQSSVBRNQTCLJQIGVQO
...

correct output
404880850

user output
k

Test 4

Group: 3

Verdict:

input
100000
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...

correct output
4999950000

user output
k

Test 5

Group: 3

Verdict:

input
100000
IPI
Q
SPGV
UNYE
...

correct output
1041990627

user output
k

Test 6

Group: 1, 2, 3

Verdict:

input
20
A
B
C
D
...

correct output
190

user output
k

Test 7

Group: 1, 2, 3

Verdict:

input
1
A

correct output
0

user output
k

Test 8

Group: 1, 2, 3

Verdict:

input
20
A
BB
CCC
DDDD
...

correct output
0

user output
k

Test 9

Group: 1, 2, 3

Verdict:

input
2
A
A

correct output
1

user output
k

Test 10

Group: 2, 3

Verdict:

input
5000
SEKNHNRHSRFYIHSCDPGXPTGUSYBFKZ...

correct output
20861

user output
k

Test 11

Group: 2, 3

Verdict:

input
5000
UGPWHWOWAREEIROZTRJGUCKDKTZJEO...

correct output
22818

user output
k

Test 12

Group: 2, 3

Verdict:

input
5000
FFQQCBCINBDWIKHFPO
SCJU
DNHYPGIQNZS
KNQCYRAXHHKORXMOVHL
...

correct output
22268

user output
k

Test 13

Group: 2, 3

Verdict:

input
5000
QVWMSYPWXWBBXWCVEOUAVQLDWNBXZB...

correct output
22589

user output
k

Test 14

Group: 2, 3

Verdict:

input
5000
JYORMNQAKXHNRBWGGSMWXWXMBKPBZU...

correct output
20482

user output
k

Test 15

Group: 3

Verdict:

input
100000
DCXXVIEYQAASZJYUUVYZUIJFGVBAYC...

correct output
8925377

user output
k

Test 16

Group: 3

Verdict:

input
100000
IJZHBIYNWQBDWNGZWVXJKXXWFVLPQX...

correct output
8907840

user output
k

Test 17

Group: 3

Verdict:

input
100000
GWUGLGQDAYGGJROIAKBMMICQMDUQQQ...

correct output
8771809

user output
k

Test 18

Group: 3

Verdict:

input
100000
SWVSVXURRSLCSHCPAKWESIPCNDKYLD...

correct output
8704480

user output
k

Test 19

Group: 3

Verdict:

input
100000
ZLSNSZBGIMCOLPDEAKVDAJCTMBNRLH...

correct output
8672362

user output
k

Test 20

Group: 1, 2, 3

Verdict:

input
20
AAB
D
CDBAA
D
...

correct output
15

user output
k

Test 21

Group: 1, 2, 3

Verdict:

input
20
A
CDD
AABBC
DBCB
...

correct output
15

user output
k

Test 22

Group: 1, 2, 3

Verdict:

input
20
ACADD
CDDCD
DACA
CCDCA
...

correct output
17

user output
k

Test 23

Group: 1, 2, 3

Verdict:

input
20
DCDA
BDBA
CACBD
BA
...

correct output
7

user output
k

Test 24

Group: 1, 2, 3

Verdict:

input
20
DDA
BBCDC
DDD
CCD
...

correct output
14

user output
k