Code Submission Evaluation System Login

Datatähti 2019 alku

Start:2018-10-01 00:00:00
End:2018-10-15 00:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - Datatähti 2019 alku - Results
History
2018-10-06 10:32:04100
2018-10-06 10:30:2340
2018-10-06 10:25:090
2018-10-06 10:12:450
2018-10-06 10:11:130
2018-10-04 22:27:270
2018-10-04 22:27:040
2018-10-04 22:26:070
2018-10-04 22:25:210
2018-10-04 20:39:100
2018-10-04 20:30:150
2018-10-04 20:09:220
2018-10-04 20:07:590
2018-10-04 20:07:400
2018-10-02 17:56:170
2018-10-02 17:55:280
2018-10-02 13:26:450
2018-10-02 10:05:260
2018-10-02 10:04:470
2018-10-02 10:04:230
2018-10-02 09:51:410
2018-10-02 09:50:280
2018-10-02 09:49:430
2018-10-02 09:48:150
2018-10-02 09:46:220
2018-10-02 09:45:370
2018-10-02 09:43:170
2018-10-02 09:39:250
2018-10-02 09:20:060
2018-10-01 17:14:540
2018-10-01 17:13:280
2018-10-01 16:45:560
2018-10-01 16:23:260
2018-10-01 14:32:030
2018-10-01 14:03:170
2018-10-01 14:03:00
Task:Leimasin
Sender:Kurns
Submission time:2018-10-06 10:32:04
Language:C++
Status:READY
Score:100

Feedback

groupverdictscore
#1ACCEPTED29
#2ACCEPTED31
#3ACCEPTED40

Test results

testverdicttime (s)group
#1ACCEPTED0.03 / 1.001details
#2ACCEPTED0.02 / 1.001details
#3ACCEPTED0.01 / 1.001details
#4ACCEPTED0.02 / 1.001details
#5ACCEPTED0.02 / 1.001details
#6ACCEPTED0.01 / 1.001details
#7ACCEPTED0.01 / 1.001details
#8ACCEPTED0.01 / 1.001details
#9ACCEPTED0.01 / 1.001details
#10ACCEPTED0.01 / 1.001details
#11ACCEPTED0.62 / 1.001details
#12ACCEPTED0.01 / 1.001details
#13ACCEPTED0.01 / 1.001details
#14ACCEPTED0.01 / 1.001details
#15ACCEPTED0.03 / 1.002details
#16ACCEPTED0.02 / 1.002details
#17ACCEPTED0.01 / 1.002details
#18ACCEPTED0.01 / 1.002details
#19ACCEPTED0.01 / 1.002details
#20ACCEPTED0.02 / 1.002details
#21ACCEPTED0.02 / 1.002details
#22ACCEPTED0.01 / 1.002details
#23ACCEPTED0.01 / 1.002details
#24ACCEPTED0.02 / 1.002details
#25ACCEPTED0.62 / 1.002details
#26ACCEPTED0.01 / 1.002details
#27ACCEPTED0.02 / 1.002details
#28ACCEPTED0.02 / 1.002details
#29ACCEPTED0.02 / 1.003details
#30ACCEPTED0.02 / 1.003details
#31ACCEPTED0.03 / 1.003details
#32ACCEPTED0.02 / 1.003details
#33ACCEPTED0.02 / 1.003details
#34ACCEPTED0.02 / 1.003details
#35ACCEPTED0.03 / 1.003details
#36ACCEPTED0.02 / 1.003details
#37ACCEPTED0.03 / 1.003details
#38ACCEPTED0.02 / 1.003details
#39ACCEPTED0.63 / 1.003details
#40ACCEPTED0.62 / 1.003details
#41ACCEPTED0.02 / 1.003details
#42ACCEPTED0.02 / 1.003details

Compiler report

input/code.cpp: In function 'bool sama(std::__cxx11::string, std::__cxx11::string, int)':
input/code.cpp:16:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int i = 0; i < leima.length(); i++) {
                  ~~^~~~~~~~~~~~~~~~
input/code.cpp: In function 'int main()':
input/code.cpp:59:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for (int x = 0; x < haluttu.length(); x++) {
                  ~~^~~~~~~~~~~~~~~~~~
input/code.cpp:85:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
    for (int i = 0; i < leimaisin.length(); i++) {
                    ~~^~~~~~~~~~~~~~~~~~~~
input/code.cpp:38:9: warning: unused variable 'aika' [-Wunused-variable]
  double aika;
         ^~~~

Code

#include <iostream>
#include <string>
#include <vector>
#include <set>
#include <ctime>


using namespace std;

vector<int> leimaukset;
string haluttu;
string leimaisin;

bool sama(string leima, string kohde, int alku) {
	bool turha = true;
	for (int i = 0; i < leima.length(); i++) {
		if (haluttu[i+alku] != leima[i]) {
			if (haluttu[i + alku] != '?') {
				return false;
			}
			else {
				continue;
			}
		}
		turha = false;
	}
	if (!turha) return true;
	return false;
}

int main()
{
	set<char> hs;
	set<char> ls;
	cin >> haluttu >> leimaisin;
	clock_t start;
	start = clock();
	double aika;

	if (haluttu[0] != leimaisin[0] || leimaisin.back() != haluttu.back() || leimaisin.size() > haluttu.size()) {
		cout << "-1" << endl;
		return 0;
	}
	for (auto i : haluttu) {
		hs.insert(i);
	}
	for (auto j : leimaisin) {
		ls.insert(j);
	}
	if (hs.size() != ls.size()) {
		cout << "-1" << endl;
		return 0;
	}




	string tavoite = "";
	for (int x = 0; x < haluttu.length(); x++) {
		tavoite.append("?");
	}


	
	bool onTehtyJotain = false;
	int alkukohta = 0;
	while (alkukohta + leimaisin.length() <= haluttu.length()) {
		if ((clock() - start) / (double)CLOCKS_PER_SEC > 0.600) {
			cout << "-1" << endl;
			return 0;
		}
		if (sama(leimaisin, haluttu, alkukohta)) {
			onTehtyJotain = true;
			leimaukset.push_back(alkukohta + 1);

			if (leimaukset.size() > 10 * haluttu.length()) {
				cout << "-1" << endl;
				return 0;
			}


			//cout << "LOYTYI SAMA; ALKUKOHTA ON " << alkukohta << " ja haluttu on " << haluttu << endl;
			
			string uusi = haluttu.substr(0, alkukohta);
			for (int i = 0; i < leimaisin.length(); i++) {
				uusi.append("?");
			}
			uusi.append(haluttu.substr(alkukohta + leimaisin.length(), haluttu.length() - (alkukohta + leimaisin.length())));
			haluttu = uusi;
			//cout << "haluttu on " << haluttu << endl;
		}
		alkukohta++;
		if (alkukohta + leimaisin.length() > haluttu.length() && haluttu != tavoite && onTehtyJotain) { //Aloita uusi kierros
			alkukohta = 0;
		}
	}

	if (haluttu == tavoite) {
		cout << leimaukset.size() << endl;
		for (int i = leimaukset.size() - 1; i >= 0; i--) {
			cout << leimaukset[i] << " ";
		}
	}
	else {
		cout << "-1" << endl;
	}

	//cout << "AIKA " << (clock() - start) / (double)CLOCKS_PER_SEC;

	int a; 
	cin >> a;
    return 0;
}

Test details

Test 1

Group: 1

Verdict: ACCEPTED

input
BBBBBBBBBB
B
view   save

correct output
10
10 9 8 7 6 5 4 3 2 1
view   save

user output
10
10 9 8 7 6 5 4 3 2 1
view   save

Test 2

Group: 1

Verdict: ACCEPTED

input
AABBABABAB
AB
view   save

correct output
6
1 9 7 5 3 2
view   save

user output
6
1 9 7 5 3 2
view   save

Test 3

Group: 1

Verdict: ACCEPTED

input
AABAAABAAA
AABAA
view   save

correct output
4
6 5 2 1
view   save

user output
4
6 5 2 1
view   save

Test 4

Group: 1

Verdict: ACCEPTED

input
BAAAAAABBB
BAAAAAABB
view   save

correct output
2
2 1
view   save

user output
2
2 1
view   save

Test 5

Group: 1

Verdict: ACCEPTED

input
AAABBABBAA
AAABBABBAA
view   save

correct output
1
1
view   save

user output
1
1
view   save

Test 6

Group: 1

Verdict: ACCEPTED

input
GGGGGGGGGG
G
view   save

correct output
10
10 9 8 7 6 5 4 3 2 1
view   save

user output
10
10 9 8 7 6 5 4 3 2 1
view   save

Test 7

Group: 1

Verdict: ACCEPTED

input
QUUQUUQUQU
QU
view   save

correct output
6
9 7 5 4 2 1
view   save

user output
6
9 7 5 4 2 1
view   save

Test 8

Group: 1

Verdict: ACCEPTED

input
DWXDWDWXHJ
DWXHJ
view   save

correct output
3
1 4 6
view   save

user output
3
1 4 6
view   save

Test 9

Group: 1

Verdict: ACCEPTED

input
FSOCRDGQBB
FSOCRDGQB
view   save

correct output
2
2 1
view   save

user output
2
2 1
view   save

Test 10

Group: 1

Verdict: ACCEPTED

input
OETMIMPUPD
OETMIMPUPD
view   save

correct output
1
1
view   save

user output
1
1
view   save

Test 11

Group: 1

Verdict: ACCEPTED

input
DOWEUOWUEU
DOWEU
view   save

correct output
-1
view   save

user output
-1
view   save

Test 12

Group: 1

Verdict: ACCEPTED

input
JQZYVSIWTE
JQZVYSIWTE
view   save

correct output
-1
view   save

user output
-1
view   save

Test 13

Group: 1

Verdict: ACCEPTED

input
ABABABABA
ABA
view   save

correct output
4
7 5 3 1
view   save

user output
4
7 5 3 1
view   save

Test 14

Group: 1

Verdict: ACCEPTED

input
AAAAAAAAAA
AAAAAAAAAB
view   save

correct output
-1
view   save

user output
-1
view   save

Test 15

Group: 2

Verdict: ACCEPTED

input
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...
B
view   save

correct output
100
100 99 98 97 96 95 94 93 92 91...
view   save

user output
100
100 99 98 97 96 95 94 93 92 91...
view   save

Test 16

Group: 2

Verdict: ACCEPTED

input
BABABAAAAAAAAAAAAAAAAAABABAAAA...
BABAAAAAAA
view   save

correct output
36
87 43 24 1 91 79 69 68 67 66 6...
view   save

user output
36
87 43 24 1 91 79 69 68 67 66 6...
view   save

Test 17

Group: 2

Verdict: ACCEPTED

input
ABABAAAAABABBBBAAAABBBBAABBBBB...
ABABAAAAABABBBBAAAABBBBAABBBBB...
view   save

correct output
22
51 50 43 41 31 28 26 24 21 20 ...
view   save

user output
22
51 50 43 41 31 28 26 24 21 20 ...
view   save

Test 18

Group: 2

Verdict: ACCEPTED

input
AAABABAAAABBBBBABABBAABBABABBA...
AABABAAAABBBBBABABBAABBABABBAB...
view   save

correct output
2
1 2
view   save

user output
2
1 2
view   save

Test 19

Group: 2

Verdict: ACCEPTED

input
AABABBBBBBAABBABABBBBBBAABBAAA...
AABABBBBBBAABBABABBBBBBAABBAAA...
view   save

correct output
1
1
view   save

user output
1
1
view   save

Test 20

Group: 2

Verdict: ACCEPTED

input
SSSSSSSSSSSSSSSSSSSSSSSSSSSSSS...
S
view   save

correct output
100
100 99 98 97 96 95 94 93 92 91...
view   save

user output
100
100 99 98 97 96 95 94 93 92 91...
view   save

Test 21

Group: 2

Verdict: ACCEPTED

input
NNNININIMNIMKLMXCNIMKLMXCDEIMK...
NIMKLMXCDE
view   save

correct output
18
1 2 3 74 5 79 58 7 84 64 37 10...
view   save

user output
18
1 2 3 74 5 79 58 7 84 64 37 10...
view   save

Test 22

Group: 2

Verdict: ACCEPTED

input
VYQFNHMVTKOEYCXWINLKLHVFMEPQEU...
VYQFNHMVTKOEYCXWINLKLHVFMEPQEU...
view   save

correct output
3
51 2 1
view   save

user output
3
51 2 1
view   save

Test 23

Group: 2

Verdict: ACCEPTED

input
IISNROLHLOJIWPTVFHFLUQRIROVLYP...
ISNROLHLOJIWPTVFHFLUQRIROVLYPM...
view   save

correct output
2
1 2
view   save

user output
2
1 2
view   save

Test 24

Group: 2

Verdict: ACCEPTED

input
WPMEMERJXXADLKONUZPUUFTPSXDHIV...
WPMEMERJXXADLKONUZPUUFTPSXDHIV...
view   save

correct output
1
1
view   save

user output
1
1
view   save

Test 25

Group: 2

Verdict: ACCEPTED

input
LNSBGZAWFJZAWFJWFJLNSBLNSBGZAL...
LNSBGZAWFJ
view   save

correct output
-1
view   save

user output
-1
view   save

Test 26

Group: 2

Verdict: ACCEPTED

input
IPIPYFUMRIPYFUMRLPIIIPYFIPYFUM...
IPYFUMRLPSYSBQWHGXQWLHBXMXXEYB...
view   save

correct output
-1
view   save

user output
-1
view   save

Test 27

Group: 2

Verdict: ACCEPTED

input
ABABABABABABABABABABABABABABAB...
ABA
view   save

correct output
49
97 95 93 91 89 87 85 83 81 79 ...
view   save

user output
49
97 95 93 91 89 87 85 83 81 79 ...
view   save

Test 28

Group: 2

Verdict: ACCEPTED

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
view   save

correct output
-1
view   save

user output
-1
view   save

Test 29

Group: 3

Verdict: ACCEPTED

input
BBBBBBBBBBBBBBBBBBBBBBBBBBBBBB...
view   save

correct output
1000
1000 999 998 997 996 995 994 9...
view   save

user output
1000
1000 999 998 997 996 995 994 9...
view   save

Test 30

Group: 3

Verdict: ACCEPTED

input
BBBBBBBBAABBBBBBBBAABBBBBBBAAB...
view   save

correct output
218
1 626 607 519 415 5 975 957 92...
view   save

user output
218
1 626 607 519 415 5 975 957 92...
view   save

Test 31

Group: 3

Verdict: ACCEPTED

input
AABBBABAABABAAABBAAAAAAABBBAAB...
view   save

correct output
55
569 639 403 761 663 437 172 90...
view   save

user output
55
569 639 403 761 663 437 172 90...
view   save

Test 32

Group: 3

Verdict: ACCEPTED

input
ABBAAABAAABAAAAABBABABBABBABBB...
view   save

correct output
2
2 1
view   save

user output
2
2 1
view   save

Test 33

Group: 3

Verdict: ACCEPTED

input
BAAABBABBBAAAABAAAABBBBABAABAA...
view   save

correct output
1
1
view   save

user output
1
1
view   save

Test 34

Group: 3

Verdict: ACCEPTED

input
UUUUUUUUUUUUUUUUUUUUUUUUUUUUUU...
view   save

correct output
1000
1000 999 998 997 996 995 994 9...
view   save

user output
1000
1000 999 998 997 996 995 994 9...
view   save

Test 35

Group: 3

Verdict: ACCEPTED

input
KSBMRKKSBMRZXBDKSKSBMRZXBDAMRZ...
view   save

correct output
178
723 731 1 935 857 820 760 735 ...
view   save

user output
178
723 731 1 935 857 820 760 735 ...
view   save

Test 36

Group: 3

Verdict: ACCEPTED

input
ILYLILYLVJILYLVJZCCQDLFRLSXZDM...
view   save

correct output
21
671 54 747 504 113 1 856 764 5...
view   save

user output
21
671 54 747 504 113 1 856 764 5...
view   save

Test 37

Group: 3

Verdict: ACCEPTED

input
ZZJZNKHDLJBPXIAZNJIIGBEEJFSDAF...
view   save

correct output
2
1 2
view   save

user output
2
1 2
view   save

Test 38

Group: 3

Verdict: ACCEPTED

input
FIMWTOLSRKOWYDPCOFUJZMXJEJFKSU...
view   save

correct output
1
1
view   save

user output
1
1
view   save

Test 39

Group: 3

Verdict: ACCEPTED

input
AIVHCGUMKSTIYBRNPONXHRFVBKPYHX...
view   save

correct output
-1
view   save

user output
-1
view   save

Test 40

Group: 3

Verdict: ACCEPTED

input
QPMSLIDCLFLBEXGVVQQNSVKJYXGETC...
view   save

correct output
-1
view   save

user output
-1
view   save

Test 41

Group: 3

Verdict: ACCEPTED

input
ABABABABABABABABABABABABABABAB...
view   save

correct output
499
997 995 993 991 989 987 985 98...
view   save

user output
499
997 995 993 991 989 987 985 98...
view   save

Test 42

Group: 3

Verdict: ACCEPTED

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
view   save

correct output
-1
view   save

user output
-1
view   save