Code Submission Evaluation System Login

HIIT Open 2017

Start:2017-05-27 11:00:00
End:2017-05-27 16:00:00
 

Tasks | Messages | Scoreboard | Statistics


CSES - HIIT Open 2017 - Results
History
2017-05-27 15:12:02
2017-05-27 15:07:54
2017-05-27 15:04:51
Task:Median string
Sender:Ace of Spades
Submission time:2017-05-27 15:12:02
Language:C++
Status:READY
Result:ACCEPTED

Test results

testverdicttime (s)
#1ACCEPTED0.07 / 1.00details
#2ACCEPTED0.06 / 1.00details
#3ACCEPTED0.03 / 1.00details
#4ACCEPTED0.05 / 1.00details
#5ACCEPTED0.11 / 1.00details
#6ACCEPTED0.06 / 1.00details
#7ACCEPTED0.05 / 1.00details
#8ACCEPTED0.04 / 1.00details
#9ACCEPTED0.05 / 1.00details
#10ACCEPTED0.05 / 1.00details
#11ACCEPTED0.04 / 1.00details
#12ACCEPTED0.05 / 1.00details
#13ACCEPTED0.07 / 1.00details
#14ACCEPTED0.05 / 1.00details
#15ACCEPTED0.07 / 1.00details
#16ACCEPTED0.05 / 1.00details
#17ACCEPTED0.05 / 1.00details
#18ACCEPTED0.05 / 1.00details
#19ACCEPTED0.04 / 1.00details
#20ACCEPTED0.04 / 1.00details
#21ACCEPTED0.07 / 1.00details
#22ACCEPTED0.05 / 1.00details
#23ACCEPTED0.04 / 1.00details
#24ACCEPTED0.05 / 1.00details
#25ACCEPTED0.07 / 1.00details
#26ACCEPTED0.10 / 1.00details
#27ACCEPTED0.08 / 1.00details
#28ACCEPTED0.10 / 1.00details
#29ACCEPTED0.11 / 1.00details
#30ACCEPTED0.08 / 1.00details
#31ACCEPTED0.09 / 1.00details
#32ACCEPTED0.13 / 1.00details
#33ACCEPTED0.10 / 1.00details
#34ACCEPTED0.10 / 1.00details
#35ACCEPTED0.08 / 1.00details
#36ACCEPTED0.10 / 1.00details
#37ACCEPTED0.12 / 1.00details
#38ACCEPTED0.07 / 1.00details
#39ACCEPTED0.11 / 1.00details
#40ACCEPTED0.10 / 1.00details
#41ACCEPTED0.07 / 1.00details
#42ACCEPTED0.09 / 1.00details
#43ACCEPTED0.08 / 1.00details
#44ACCEPTED0.09 / 1.00details
#45ACCEPTED0.09 / 1.00details

Compiler report

input/code.cpp: In function 'int main()':
input/code.cpp:50:21: warning: array subscript has type 'char' [-Wchar-subscripts]
        if(a1) t[a[i]]++;
                     ^
input/code.cpp:51:21: warning: array subscript has type 'char' [-Wchar-subscripts]
        if(b1) t[b[j]]++;
                     ^
input/code.cpp:52:21: warning: array subscript has type 'char' [-Wchar-subscripts]
        if(c1) t[c[k]]++;
                     ^
input/code.cpp:54:23: warning: array subscript has type 'char' [-Wchar-subscripts]
        if(a1 && t[a[i]] > 1) q = a[i];
                       ^
input/code.cpp:55:23: warning: array subscript has type 'char' [-Wchar-subscripts]
        if(b1 && t[b[j]] > 1) q = b[j];
                       ^
input/code.cpp:56:23: warning: array subscript has type 'char' [-Wchar-subscripts]
        if(c1 && t[c[k]] > 1) q = c[k];
                       ^
input/code.cpp:71:21: warning: array subscript has type 'char' [-Wchar-subscripts]
        if(a1) t[a[i]]--;
                     ^
input/code.cpp:72:21: warning: array subscript has type 'char' [-Wchar-subscripts]
        if(b1) t[b[j]]--;
                     ^
input/code.cpp:73:21: warning: array subscript has type 'char' [-Wchar-subscripts]
        if(c1) t[c[k]]--;
                     ^

Code

#include <bits/stdc++.h>
using namespace std;
string dp2[51][51][51];
int dp[51][51][51];
int main() {
    for(int i = 0; i < 51; ++i) {
	for(int j = 0; j < 51; ++j) {
	    for(int k = 0; k < 51; ++k) {
		dp[i][j][k] = 1e9;
	    }
	}
    }
    string a,b,c;
    cin>>a>>b>>c;
    int an, bn, cn;
    an = a.size();
    bn = b.size();
    cn = c.size();
    int t[200] = {0};
    dp[0][0][0] = 0;
    for(int i = 0; i <= an; ++i) {
	for(int j = 0; j <= bn; ++j) {
	    for(int k = 0; k <= cn; ++k) {
		if(i < an) {
		    if(dp[i+1][j][k] > dp[i][j][k]+1) {
			dp[i+1][j][k] = dp[i][j][k]+1;
			dp2[i+1][j][k] = dp2[i][j][k];
		    }
		}
		if(j < bn) {
		    if(dp[i][j+1][k] > dp[i][j][k]+1) {
			dp[i][j+1][k] = dp[i][j][k]+1;
			dp2[i][j+1][k] = dp2[i][j][k];
		    }
		}
		if(k < cn) {
		    if(dp[i][j][k+1] > dp[i][j][k]+1) {
			dp[i][j][k+1] = dp[i][j][k]+1;
			dp2[i][j][k+1] = dp2[i][j][k];
		    }
		}
		for(int a1 = 0; a1 < 2; ++a1) {
		    for(int b1 = 0; b1 < 2; ++b1) {
			for(int c1 = 0; c1 < 2; ++c1) {
			    if(i+a1 > an || j+b1 > bn || k+c1 > cn) continue;
			    int cost = 0;
			    if(a1 == 0) ++cost;
			    if(b1 == 0) ++cost;
			    if(c1 == 0) ++cost;
			    if(a1) t[a[i]]++;
			    if(b1) t[b[j]]++;
			    if(c1) t[c[k]]++;
			    char q = 0;
			    if(a1 && t[a[i]] > 1) q = a[i];
			    if(b1 && t[b[j]] > 1) q = b[j];
			    if(c1 && t[c[k]] > 1) q = c[k];
			    if(q == 0) {
				if(a1) q = a[i];
				if(b1) q = b[j];
				if(c1) q = c[k];
			    }
			    if(a1) cost += (a[i] != q);
			    if(b1) cost += (b[j] != q);
			    if(c1) cost += (c[k] != q);
			    if(dp[i+a1][j+b1][k+c1] > dp[i][j][k] + cost) {
				dp[i+a1][j+b1][k+c1] = dp[i][j][k] + cost;
				dp2[i+a1][j+b1][k+c1] = dp2[i][j][k];
				dp2[i+a1][j+b1][k+c1].push_back(q);

			    }
			    if(a1) t[a[i]]--;
			    if(b1) t[b[j]]--;
			    if(c1) t[c[k]]--;
			}
		    }
		}
		if(i != an || j != bn || k != cn) 
		dp2[i][j][k].clear();
	    }
	}
    }
    cout<<dp2[an][bn][cn]<<endl;
}

Test details

Test 1

Verdict: ACCEPTED

input
A
A
A
view   save

correct output
A
view   save

user output
A
view   save

Test 2

Verdict: ACCEPTED

input
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
A
A
view   save

correct output
A
view   save

user output
A
view   save

Test 3

Verdict: ACCEPTED

input
A
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
A
view   save

correct output
A
view   save

user output
A
view   save

Test 4

Verdict: ACCEPTED

input
A
A
AAAAAAAAAAAAAAAAAAAAAAAAAAAAAA...
view   save

correct output
A
view   save

user output
A
view   save

Test 5

Verdict: ACCEPTED

input
EEBAKAUUFWHXAHYEANNASFUDNDZXXL...
AQFZGVBKKVBEMTTJHESKDIULFHRZZI...
JGBFSBLBMLIYHZRMFJZVZKSESLPPBN...
view   save

correct output
EGBAKBBMFTHFJHEAKDASLFHBNZGXVM...
view   save

user output
JGBBKBMLIYHFJHEZKSESLFPBNZIAVB...
view   save

Test 6

Verdict: ACCEPTED

input
BABAAAAB
BBAAAAAAB
BBBABABB
view   save

correct output
BBABAAAAB
view   save

user output
BABAAAAB
view   save

Test 7

Verdict: ACCEPTED

input
AAAAA
AAABAAA
BBAAAA
view   save

correct output
AAAAAA
view   save

user output
BAAAAA
view   save

Test 8

Verdict: ACCEPTED

input
AABAABB
ABAAAB
BBABAABA
view   save

correct output
ABABAABA
view   save

user output
BABAABB
view   save

Test 9

Verdict: ACCEPTED

input
BAABAB
BBAAABAAAA
ABAAABBB
view   save

correct output
BBAAABAB
view   save

user output
ABAAABAB
view   save

Test 10

Verdict: ACCEPTED

input
BABAB
AABABBBA
BABABBB
view   save

correct output
BABABBB
view   save

user output
BABABBB
view   save

Test 11

Verdict: ACCEPTED

input
AAABBBABBB
BABBABABB
ABBBB
view   save

correct output
AABBBABB
view   save

user output
BABBBABB
view   save

Test 12

Verdict: ACCEPTED

input
AABAAABBAA
BABAB
BBBAA
view   save

correct output
BABBAA
view   save

user output
BBBAA
view   save

Test 13

Verdict: ACCEPTED

input
BBBBBBBBA
AABABAABA
ABBBAAA
view   save

correct output
ABBBBAABA
view   save

user output
AABBBAABA
view   save

Test 14

Verdict: ACCEPTED

input
BABBBABAA
AABBBBABB
AABBBAB
view   save

correct output
AABBBABA
view   save

user output
AABBBABB
view   save

Test 15

Verdict: ACCEPTED

input
ABBBBBBB
ABBABABBA
BBBBABBBA
view   save

correct output
ABBBBABBBA
view   save

user output
ABBBBBBA
view   save

Test 16

Verdict: ACCEPTED

input
BBABABAB
BBBBBA
AABAAA
view   save

correct output
BBABABA
view   save

user output
BABABA
view   save

Test 17

Verdict: ACCEPTED

input
AAABAAAA
ABABAB
BBBBBBB
view   save

correct output
ABABABA
view   save

user output
BABABAB
view   save

Test 18

Verdict: ACCEPTED

input
BBABABA
BABAAAABAA
BABBB
view   save

correct output
BABABABA
view   save

user output
BBABABA
view   save

Test 19

Verdict: ACCEPTED

input
AABBABB
BBBBAABBBA
BAABBAA
view   save

correct output
BAABBABA
view   save

user output
BAABBBA
view   save

Test 20

Verdict: ACCEPTED

input
BBBBBAA
AAABAAAA
AAABBABB
view   save

correct output
AAABBAAA
view   save

user output
AAABBAAA
view   save

Test 21

Verdict: ACCEPTED

input
AAAABBA
ABAABA
BBABBBBBA
view   save

correct output
ABAABBA
view   save

user output
ABAABBA
view   save

Test 22

Verdict: ACCEPTED

input
BBBABAB
ABBABBBAA
ABBBAABABB
view   save

correct output
ABBBABAB
view   save

user output
ABBBABAB
view   save

Test 23

Verdict: ACCEPTED

input
BBAAA
BBABAB
ABBBBABBB
view   save

correct output
BBABAB
view   save

user output
BBABAB
view   save

Test 24

Verdict: ACCEPTED

input
AABABBBAAB
BBBABBBA
ABBAAAB
view   save

correct output
ABBABBBAAB
view   save

user output
ABBABBAAB
view   save

Test 25

Verdict: ACCEPTED

input
ABBBBBBBB
BAABAABAAA
BAAAABAAAB
view   save

correct output
BAABAABAAAB
view   save

user output
BAABABBAAB
view   save

Test 26

Verdict: ACCEPTED

input
BBDDCBBCDBAABAACBAADACABBDDABB...
DADBBCADDBADBADBADBBDABCABDCAD...
CADACCBCDCADBBBAACBBAACCCBABBC...
view   save

correct output
BADACCBCDBADBAACBAADACBABBCABB...
view   save

user output
CADACCBCDBADBAACBAADCBABBCABBD...
view   save

Test 27

Verdict: ACCEPTED

input
ADCDADBDDDCACBCCBCACDCDBCBCDBB...
DCCACADACBCDDBBDBADBABADCCDBCA...
DAAAADCDACCDBBDABCCDDAABCBACCD...
view   save

correct output
DCAADADCDACBDBBDABDCCDBCABCBAC...
view   save

user output
DCAADADCDACBDBBDABCCCDBCBCBACA...
view   save

Test 28

Verdict: ACCEPTED

input
CBCBABACDDACDCBCBBBADACDCDCBCA...
DAACABBDCAABCCAACBCCDBCBADDBCD...
BDDCACBCBDCBCCCBCCCCBCABCDDCCC...
view   save

correct output
DCACBABDCABCCACBCCBCBADABCDDCC...
view   save

user output
DCACBCBDCBCACBCCBCBADBCDDCCABA...
view   save

Test 29

Verdict: ACCEPTED

input
CCBADBAACDDCBAABCADBDBDCCBCCDC...
BBCCABBCBBABBDBCAADBDDABCDBACC...
CADCDBBBBBDCAAACCBDDABDAABBBDA...
view   save

correct output
CABCBBABBDBAAACBDDABDAABCABBDB...
view   save

user output
CABCDBABBDDCAAABDDABBDBADCABCC...
view   save

Test 30

Verdict: ACCEPTED

input
DCBDBABAADBDCDCDDDCCDACADDCCAC...
ACACCCBDDBCCACBDDADADCBADDDADC...
DBABACDDBADBBDAACAACDCCCAACBBC...
view   save

correct output
DCBABACDDBACDCBDDACAACADDCCACD...
view   save

user output
DBABACBDDBCCDCBDDACAACADDCCACD...
view   save

Test 31

Verdict: ACCEPTED

input
BCBACAADABAACACADCADCDAAACDDDD...
DCDCCCBDDCBDCDCADCCBDDBBDBDADA...
BCDCCBCDDBBBBBCBDCDAADACDCBBAD...
view   save

correct output
BCDCCBADDBBACDCADCDAADACDBDADA...
view   save

user output
BCDCCBCDDBBBCDCADCDAADACDBDADA...
view   save

Test 32

Verdict: ACCEPTED

input
ACDCDACCABADADABADDAAACBDCABBB...
CDDACACAAABCAACABADABBAABDDDDB...
ACCADACCABBBABAAABACBCCACACABD...
view   save

correct output
ACDADACCABABACABADAABACBDCABBA...
view   save

user output
ACDADACCABABAAABADBCAACDDCABBD...
view   save

Test 33

Verdict: ACCEPTED

input
ABCCDCADCDADAADBDDBBABDACBBAAC...
BCDADCDCBDBCBDABDACBBCAAADBAAA...
BBADBCDBABDBDDCBDAADDAADAADDCA...
view   save

correct output
BCDADCDBABDBDDCBDABDACBBAAADCA...
view   save

user output
BCDADCDDABDBDCBDABDACBBAADDCAB...
view   save

Test 34

Verdict: ACCEPTED

input
DABDBACDBADABBDDBAACCAADABDBBD...
DCCDCCACCDCBCDADCAABDBDBADACDA...
DBDCBAAADBDBACACDDCDBDBABDBDDA...
view   save

correct output
DABDCBACADBDADCAABDBDBAACDAADA...
view   save

user output
DCBDCBAACDBDACACBDCDBABACDAADA...
view   save

Test 35

Verdict: ACCEPTED

input
BCBABDCADCBADCAABCACCBDAABBCBD...
BCDDADBBBBCCACDADBDAADBCDDABCB...
CACCBDBCABBBBCCDBBCDDBBAADDBBB...
view   save

correct output
BCBDBDCADBBBBCCABCDADBDAADBCBD...
view   save

user output
BCBDBCADBBBBCCABCDADBDAADBCBDB...
view   save

Test 36

Verdict: ACCEPTED

input
TFWRLHNANNYROWCGQJUHNIAHQTQMJF...
FTIHRBYDSVTMVNJECPGSWQPYJQHYIQ...
DXCJBPJENDRYJASOLLFPCAHWKCCSJC...
view   save

correct output
TFCRBHJANDNYJOCGQPJAHNIACFJCMJ...
view   save

user output
TXCRBPJENDRYJOCGQPJAHWIACSJCMJ...
view   save

Test 37

Verdict: ACCEPTED

input
HLQGBFZAPEMVFIDMBTZLKOSTCSBKPX...
PKVCUBARUWFACSXTYGWNBTAPFLTNQJ...
VNZVXPAKAWJAUFUOBHCMRBSYVCRWTS...
view   save

correct output
HKVGBAKAWEACFIBHCMNBTALCLSTSBJ...
view   save

user output
PKAWBAUFUOFHCMBTYRWTSTJDLQPXNH...
view   save

Test 38

Verdict: ACCEPTED

input
BURAOHCWCRFABWYQTGIDCIJZGAGOQH...
JFCLZYUMKEPWFDADMHSEPAPTZJINGW...
VTMIHPQTSFBAAVMJULWRWXGCOSSGGG...
view   save

correct output
BUMIHPWFBAAMWREPGDCIJIGGGQHJAJ...
view   save

user output
VUMIHPWFBAAMWRWXGPCOJSGGGVHJCP...
view   save

Test 39

Verdict: ACCEPTED

input
JHLXFPNXFCWAXXBNOOKKAAOYCAJQNC...
FYVNDFBYLABSLINLIFGCIFYKMFOJVS...
RUCZHUZGVIWBVIMDHRCQUVFPCPMWNE...
view   save

correct output
FHPNDFCWABLINDFGCAAFYCMJNCCHYE...
view   save

user output
ZHUNGFIWABVINHRCQUVFYCMJNEPHYX...
view   save

Test 40

Verdict: ACCEPTED

input
XPRJAEQNVMRJPRONUEBLIRWTWQLPCT...
RZXRIREFPPPMDZNDNVWQDNIJDHQXRN...
YCWFBHCDICSHJZJUFJETHSCBONSPAH...
view   save

correct output
XRIAEFBHMDICDNJEBLIJDTHQCXRNAA...
view   save

user output
XRYCEFBHMDICSNJZJUIJETHQCXRNPA...
view   save

Test 41

Verdict: ACCEPTED

input
LIFBDNCQAUIBFDBQWYQYHHIHTILAGL...
GLGNIELKZRTINBSQJLJIUDNZRNIIUT...
GMGMTIKEFLSPHZDUBJYFFFLARRMRQC...
view   save

correct output
GLGNIKBDNSQAJIUDBJYFIILAGJCEAK...
view   save

user output
GLGTIKEFNSQHZIUDBJYFIILAGRMRQC...
view   save

Test 42

Verdict: ACCEPTED

input
XVRPEIHNUVILHOMUZVSDUBCCWFCUPR...
JOGXOJPJADTKGHUZDXYITOXAMCAHDG...
XHWWVTDWXEFBOORSRSUMYLBFBHHQBO...
view   save

correct output
XHJPIADTKEFHOUZSDUYCBAFCAHBGEU...
view   save

user output
XHWPVTDWXEFHOUZSDUMYLBFHHQBOEI...
view   save

Test 43

Verdict: ACCEPTED

input
NVXEUOKZUBIPREENTXKZNJCKOJWSZX...
ONHVYUTVDSFZWJGNGPAJUVVPMHYMCK...
SPFNJIHJNXHUIVTJNJDLOWRZAWGSYT...
view   save

correct output
NVEUJFZJNGPJUEVTJHNJCKOAWSFZUA...
view   save

user output
FNHXHUIVZJNGPAJDLOWRZAWCKYTKRZ...
view   save

Test 44

Verdict: ACCEPTED

input
TPMZYIOLFNHUYUTQEGXKDUVWIIGPZR...
DVKIWQHFEIYKOYZJABOANEWDSCBJIB...
YEDBURWELMPTXUYWOCWTGZQKOIEZFJ...
view   save

correct output
TEDBKIWELFIHKUYBOANEGDCBJIBBEZ...
view   save

user output
YEDBUIWLPTXUYWOWTGQKOIEWIFJPUR...
view   save

Test 45

Verdict: ACCEPTED

input
OPTIBHSPIKWOVIIAJSDRGAHPPSWHGZ...
YHUVWOJXYEPAGOOXQNVNGNLMGGABTK...
GWWQYCWJKILMNTGXDTCMLCMMHKKIDW...
view   save

correct output
BHSPICWOJIIENAGODCGAHKGDWHGCAB...
view   save

user output
GHWQYCWOKILMNAGXDCMMHKIDWHGCAB...
view   save