Task: | Freight trains |
Sender: | aalto2024e_002 |
Submission time: | 2024-09-30 17:08:27 +0300 |
Language: | C++ (C++17) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | ACCEPTED | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | ACCEPTED | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | ACCEPTED | 0.00 s | details |
#8 | ACCEPTED | 0.00 s | details |
#9 | ACCEPTED | 0.00 s | details |
#10 | ACCEPTED | 0.00 s | details |
#11 | WRONG ANSWER | 0.00 s | details |
#12 | ACCEPTED | 0.00 s | details |
#13 | ACCEPTED | 0.00 s | details |
#14 | ACCEPTED | 0.00 s | details |
#15 | ACCEPTED | 0.00 s | details |
#16 | ACCEPTED | 0.00 s | details |
#17 | ACCEPTED | 0.00 s | details |
#18 | ACCEPTED | 0.00 s | details |
#19 | WRONG ANSWER | 0.00 s | details |
#20 | ACCEPTED | 0.00 s | details |
#21 | ACCEPTED | 0.00 s | details |
#22 | ACCEPTED | 0.00 s | details |
#23 | ACCEPTED | 0.00 s | details |
#24 | ACCEPTED | 0.00 s | details |
#25 | ACCEPTED | 0.00 s | details |
#26 | ACCEPTED | 0.00 s | details |
#27 | WRONG ANSWER | 0.00 s | details |
#28 | WRONG ANSWER | 0.00 s | details |
#29 | WRONG ANSWER | 0.00 s | details |
#30 | ACCEPTED | 0.00 s | details |
#31 | WRONG ANSWER | 0.00 s | details |
#32 | WRONG ANSWER | 0.00 s | details |
#33 | WRONG ANSWER | 0.00 s | details |
#34 | WRONG ANSWER | 0.00 s | details |
#35 | WRONG ANSWER | 0.00 s | details |
#36 | WRONG ANSWER | 0.00 s | details |
#37 | WRONG ANSWER | 0.00 s | details |
#38 | WRONG ANSWER | 0.00 s | details |
#39 | WRONG ANSWER | 0.00 s | details |
#40 | WRONG ANSWER | 0.00 s | details |
#41 | WRONG ANSWER | 0.00 s | details |
#42 | WRONG ANSWER | 0.00 s | details |
#43 | WRONG ANSWER | 0.00 s | details |
#44 | WRONG ANSWER | 0.00 s | details |
#45 | WRONG ANSWER | 0.00 s | details |
#46 | WRONG ANSWER | 0.00 s | details |
#47 | WRONG ANSWER | 0.00 s | details |
#48 | WRONG ANSWER | 0.00 s | details |
#49 | WRONG ANSWER | 0.00 s | details |
#50 | WRONG ANSWER | 0.00 s | details |
#51 | WRONG ANSWER | 0.00 s | details |
#52 | WRONG ANSWER | 0.00 s | details |
#53 | WRONG ANSWER | 0.00 s | details |
#54 | WRONG ANSWER | 0.00 s | details |
#55 | WRONG ANSWER | 0.00 s | details |
#56 | WRONG ANSWER | 0.00 s | details |
#57 | WRONG ANSWER | 0.01 s | details |
#58 | WRONG ANSWER | 0.00 s | details |
#59 | WRONG ANSWER | 0.01 s | details |
#60 | WRONG ANSWER | 0.00 s | details |
#61 | WRONG ANSWER | 0.00 s | details |
#62 | TIME LIMIT EXCEEDED | -- | details |
#63 | TIME LIMIT EXCEEDED | -- | details |
#64 | TIME LIMIT EXCEEDED | -- | details |
#65 | TIME LIMIT EXCEEDED | -- | details |
#66 | TIME LIMIT EXCEEDED | -- | details |
#67 | TIME LIMIT EXCEEDED | -- | details |
#68 | TIME LIMIT EXCEEDED | -- | details |
#69 | TIME LIMIT EXCEEDED | -- | details |
#70 | TIME LIMIT EXCEEDED | -- | details |
#71 | TIME LIMIT EXCEEDED | -- | details |
Code
#include <bits/stdc++.h> #define REP(i, a, b) for (int i = a; i < b; i++) // Type Aliases for 1D and 2D vectors with initialization #define vll(n, val) vector<long long>(n, val) // 1D vector of long longs with size n, initialized to val #define ll long long #define vvi(n, m, val) vector<vector<int>>(n, vector<int>(m, val)) // 2D vector of ints (n x m), initialized to val #define vvll(n, m, val) vector<vector<long long>>(n, vector<long long>(m, val)) // 2D vector of long longs (n x m), initialized to val using namespace std; bool min_lexi_result_compare(const string &s, const string &t); void print_vector(vector<int> &x) { for (int v : x) { cout << v << " "; } cout << "\n"; } void print_matrix(vector<vector<int>> &matrix) { cout << "\n" << "----------------" << "\n"; for (vector<int> row : matrix) { print_vector(row); } cout << "\n" << "----------------" << "\n"; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n; cin >> n; vector<string> ids(n); for (int i = 0; i < n; i++) { cin >> ids[i]; } sort(ids.begin(), ids.end(), min_lexi_result_compare); for (string c : ids) { cout << c; } cout << endl; } bool min_lexi_result_compare(const string &s, const string &t) { size_t i = 0, j = 0; size_t len_s = s.length(), len_t = t.length(); size_t total_len = len_s + len_t; while (i + j < total_len) { char c1 = (i < len_s) ? s[i] : t[i - len_s]; char c2 = (j < len_t) ? t[j] : s[j - len_t]; if (c1 != c2) return c1 < c2; if (i < len_s) ++i; else ++j; } return false; // s + t == t + s, which is impossible since s != t }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
1 gl |
correct output |
---|
gl |
user output |
---|
gl |
Test 2
Verdict: ACCEPTED
input |
---|
2 adedf ff |
correct output |
---|
adedfff |
user output |
---|
adedfff |
Test 3
Verdict: ACCEPTED
input |
---|
2 jb lj |
correct output |
---|
jblj |
user output |
---|
jblj |
Test 4
Verdict: ACCEPTED
input |
---|
2 qlipb sr |
correct output |
---|
qlipbsr |
user output |
---|
qlipbsr |
Test 5
Verdict: ACCEPTED
input |
---|
3 f llk onfj |
correct output |
---|
fllkonfj |
user output |
---|
fllkonfj |
Test 6
Verdict: ACCEPTED
input |
---|
3 jaeo mob nk |
correct output |
---|
jaeomobnk |
user output |
---|
jaeomobnk |
Test 7
Verdict: ACCEPTED
input |
---|
3 nemlo psqhy sg |
correct output |
---|
nemlopsqhysg |
user output |
---|
nemlopsqhysg |
Test 8
Verdict: ACCEPTED
input |
---|
4 dia eh fbcae gf |
correct output |
---|
diaehfbcaegf |
user output |
---|
diaehfbcaegf |
Test 9
Verdict: ACCEPTED
input |
---|
4 c cbfaa egbg fc |
correct output |
---|
cbfaacegbgfc |
user output |
---|
cbfaacegbgfc |
Test 10
Verdict: ACCEPTED
input |
---|
4 cbc cdd ceed dbeea |
correct output |
---|
cbccddceeddbeea |
user output |
---|
cbccddceeddbeea |
Test 11
Verdict: WRONG ANSWER
input |
---|
4 bfec bgbaf fcg fdbbg |
correct output |
---|
bfecbgbaffcgfdbbg |
user output |
---|
bfecbgbaffdbbgfcg |
Test 12
Verdict: ACCEPTED
input |
---|
5 aoefh ge imgjj kmj ... |
correct output |
---|
aoefhgeimgjjkmjmhhi |
user output |
---|
aoefhgeimgjjkmjmhhi |
Test 13
Verdict: ACCEPTED
input |
---|
5 bcbec ei fdigc ilabd ... |
correct output |
---|
bcbeceifdigcilabdlg |
user output |
---|
bcbeceifdigcilabdlg |
Test 14
Verdict: ACCEPTED
input |
---|
5 a d db glfff ... |
correct output |
---|
adbdglfffih |
user output |
---|
adbdglfffih |
Test 15
Verdict: ACCEPTED
input |
---|
5 ab d ebhin k ... |
correct output |
---|
abdebhinknab |
user output |
---|
abdebhinknab |
Test 16
Verdict: ACCEPTED
input |
---|
5 fasgx o oezws qua ... |
correct output |
---|
fasgxoezwsoquaspfd |
user output |
---|
fasgxoezwsoquaspfd |
Test 17
Verdict: ACCEPTED
input |
---|
5 bcggd dcg e fc ... |
correct output |
---|
bcggddcgefcg |
user output |
---|
bcggddcgefcg |
Test 18
Verdict: ACCEPTED
input |
---|
5 cmo cx hftbb mil ... |
correct output |
---|
cmocxhftbbmiltksr |
user output |
---|
cmocxhftbbmiltksr |
Test 19
Verdict: WRONG ANSWER
input |
---|
5 ab ababa b ca ... |
correct output |
---|
ababaabbcaccb |
user output |
---|
ababababccbca |
Test 20
Verdict: ACCEPTED
input |
---|
5 o rjj sfj ti ... |
correct output |
---|
orjjsfjtiw |
user output |
---|
orjjsfjtiw |
Test 21
Verdict: ACCEPTED
input |
---|
5 a aa aaa abbab ... |
correct output |
---|
aaaaaaabbabba |
user output |
---|
aaaaaaabbabba |
Test 22
Verdict: ACCEPTED
input |
---|
10 aoefh f ge hlmgh ... |
correct output |
---|
aoefhfgehlmghimgjjjkmjmhhinmol... |
user output |
---|
aoefhfgehlmghimgjjjkmjmhhinmol... |
Test 23
Verdict: ACCEPTED
input |
---|
10 bcbec cjjil dbigk ei ... |
correct output |
---|
bcbeccjjildbigkeifdigcgfbikfil... |
user output |
---|
bcbeccjjildbigkeifdigcgfbikfil... |
Test 24
Verdict: ACCEPTED
input |
---|
10 a cij d db ... |
correct output |
---|
acijdbddhhekcgibfgglfffihkg |
user output |
---|
acijdbddhhekcgibfgglfffihkg |
Test 25
Verdict: ACCEPTED
input |
---|
10 ab d ebhin fk ... |
correct output |
---|
abdebhinfkgjdinaiodgkacknab |
user output |
---|
abdebhinfkgjdinaiodgkacknab |
Test 26
Verdict: ACCEPTED
input |
---|
10 buywl fasgx gb jzpek ... |
correct output |
---|
buywlfasgxgbjzpekoezwsoquaspfd... |
user output |
---|
buywlfasgxgbjzpekoezwsoquaspfd... |
Test 27
Verdict: WRONG ANSWER
input |
---|
10 acg bcggd dcg dede ... |
correct output |
---|
acgbcggddcgdedeefcfdbbfgabbg |
user output |
---|
acgbcggddcgdedeefdbbfcfgabbg |
Test 28
Verdict: WRONG ANSWER
input |
---|
10 cmo cx dpr dtir ... |
correct output |
---|
cmocxdprdtirhftbbmfmiltksrttkb... |
user output |
---|
cmocxdprdtirhftbbmilmfttkbqtks... |
Test 29
Verdict: WRONG ANSWER
input |
---|
10 ab ababa abbc b ... |
correct output |
---|
ababaababbcbbbcaccbcccccc |
user output |
---|
abababaabbcbbbccbcacccccc |
Test 30
Verdict: ACCEPTED
input |
---|
10 dmq gl j jqso ... |
correct output |
---|
dmqgljjqsoorjjsfjtiulvw |
user output |
---|
dmqgljjqsoorjjsfjtiulvw |
Test 31
Verdict: WRONG ANSWER
input |
---|
10 a aa aaa abbab ... |
correct output |
---|
aaaaaaabbabbabbabbabbbbbabbbbb |
user output |
---|
aaaaaaabbabbbbbabbabbbababbbbb |
Test 32
Verdict: WRONG ANSWER
input |
---|
100 aa acmfac afmolcn alllbndbli ... |
correct output |
---|
aaacmfacafmolcnalllbndbliamdal... |
user output |
---|
aaacmfacafmolcnalllbndbliamdal... Truncated |
Test 33
Verdict: WRONG ANSWER
input |
---|
100 a acjgj ae aegdb ... |
correct output |
---|
aacjgjaeaegdbafcbahledfchagaja... |
user output |
---|
aacjgjakbjchiaghajahledfchagae... Truncated |
Test 34
Verdict: WRONG ANSWER
input |
---|
100 a aah abaeeaifc abajl ... |
correct output |
---|
aaahabaeeaifcabajlaehaejcdegka... |
user output |
---|
aaahalejkgecaalakaeaibcaejcdeg... Truncated |
Test 35
Verdict: WRONG ANSWER
input |
---|
100 a aa abg abndfmmmk ... |
correct output |
---|
aaaabgabndfmmmkacggjdeacogeada... |
user output |
---|
aaaabndfmmmkacggjdeacogeadaehc... Truncated |
Test 36
Verdict: WRONG ANSWER
input |
---|
100 afn aic ajrkgzldb amcyqyh ... |
correct output |
---|
afnaicajrkgzldbamcyqyhandanxhj... |
user output |
---|
aicafnatfzazcbaposaxranxhjoeam... Truncated |
Test 37
Verdict: WRONG ANSWER
input |
---|
100 aacdeffdd abaacbae abfbbff ac ... |
correct output |
---|
aacdeffddabaacbaeabfbbffacacbg... |
user output |
---|
abaacbaeaacdeffddagafggdafeafb... Truncated |
Test 38
Verdict: WRONG ANSWER
input |
---|
100 abnfxhutgk ajkdoqmdqp asxeblm badpwpsqhn ... |
correct output |
---|
abnfxhutgkajkdoqmdqpasxeblmbad... |
user output |
---|
ajkdoqmdqpabnfxhutgkasxeblmbad... Truncated |
Test 39
Verdict: WRONG ANSWER
input |
---|
100 a aa aaaaacaca aaaabcabc ... |
correct output |
---|
aaaaaaaacacaaaaabcabcaaabaaaab... |
user output |
---|
aaaabbbbbbbabcbbcbabbbcbbabbca... Truncated |
Test 40
Verdict: WRONG ANSWER
input |
---|
100 a aiesfhkro aivvkdc ajrtj ... |
correct output |
---|
aaiesfhkroaivvkdcajrtjaqfnivlb... |
user output |
---|
aaiesfhkroaqfnivlaivvkdcajrtjb... Truncated |
Test 41
Verdict: WRONG ANSWER
input |
---|
100 a aa aaaa aaaaa ... |
correct output |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaabab... |
user output |
---|
aaaaaaaaaaaaaaaaaaaaaababaaaba... Truncated |
Test 42
Verdict: WRONG ANSWER
input |
---|
200 a aa abbhjifdb acmfac ... |
correct output |
---|
aaaabbhjifdbacmfacadiadnhkaehh... |
user output |
---|
aaaacmfacabbhjifdbaofmclooaoef... Truncated |
Test 43
Verdict: WRONG ANSWER
input |
---|
200 a aa abihiahg acjgj ... |
correct output |
---|
aaaabihiahgacjgjadaeaegdbafcba... |
user output |
---|
aaaakbjchiaghaljacggakhlcjakgl... Truncated |
Test 44
Verdict: WRONG ANSWER
input |
---|
200 a aah abaeeaifc abajl ... |
correct output |
---|
aaahabaeeaifcabajlaehaejcdegka... |
user output |
---|
aaahalkalhahfglkalejkgecaalaka... Truncated |
Test 45
Verdict: WRONG ANSWER
input |
---|
200 a aa aan abg ... |
correct output |
---|
aaaaanabgabndfmmmkacggjdeacoge... |
user output |
---|
aaaaanabgabndfmmmkacggjdeacoge... Truncated |
Test 46
Verdict: WRONG ANSWER
input |
---|
200 ad aegewtfc afn aic ... |
correct output |
---|
adaegewtfcafnaicajrkgzldbamcyq... |
user output |
---|
aegewtfcadatfzazcbaposaxranxhj... Truncated |
Test 47
Verdict: WRONG ANSWER
input |
---|
200 a aa aacdeffdd aaeceaeb ... |
correct output |
---|
aaaaacdeffddaaeceaebabaacbaeab... |
user output |
---|
aaaafbgdeeageccagccebfagafggda... Truncated |
Test 48
Verdict: WRONG ANSWER
input |
---|
200 abnfxhutgk aghv ajkdoqmdqp ajpvvalnu ... |
correct output |
---|
abnfxhutgkaghvajkdoqmdqpajpvva... |
user output |
---|
aghvajkdoqmdqpajpvvalnuakdmlbd... Truncated |
Test 49
Verdict: WRONG ANSWER
input |
---|
200 a aa aaaaacaca aaaabcabc ... |
correct output |
---|
aaaaaaaacacaaaaabcabcaaaacbcaa... |
user output |
---|
aaaabccbcaabbaccabccaacbcabcca... Truncated |
Test 50
Verdict: WRONG ANSWER
input |
---|
200 a abam aiesfhkro aivvkdc ... |
correct output |
---|
aabamaiesfhkroaivvkdcajrtjakam... |
user output |
---|
aabamaiesfhkroaivvkdcajrtjakam... Truncated |
Test 51
Verdict: WRONG ANSWER
input |
---|
200 a aaicd acbjfaj achddjj ... |
correct output |
---|
aaaicdacbjfajachddjjacifadaecf... |
user output |
---|
aaaicdakfdbhajdgbaighiaigdafbg... Truncated |
Test 52
Verdict: WRONG ANSWER
input |
---|
1000 a aa aaccbkcd aaj ... |
correct output |
---|
aaaaaccbkcdaajaanabaabanikjabb... |
user output |
---|
aaaaleeinoadaikoifcbjgaldgalcb... Truncated |
Test 53
Verdict: WRONG ANSWER
input |
---|
1000 a aa aabecajcf aabg ... |
correct output |
---|
aaaaabecajcfaabgaabjllgdlkaadg... |
user output |
---|
aaaahehfjailigkblaaiiggaiedcfc... Truncated |
Test 54
Verdict: WRONG ANSWER
input |
---|
1000 a aa aablaga aah ... |
correct output |
---|
aaaaablagaaahaajaaklkjjababaee... |
user output |
---|
aaaajgjaggifgajfgajfdaikcaljib... Truncated |
Test 55
Verdict: WRONG ANSWER
input |
---|
1000 a aa aagjd aajdlmacjn ... |
correct output |
---|
aaaaagjdaajdlmacjnaakjdngdfaal... |
user output |
---|
aaaalagiknbafagnccahilechcaidf... Truncated |
Test 56
Verdict: WRONG ANSWER
input |
---|
1000 a aalguz abcce abggxup ... |
correct output |
---|
aaalguzabcceabggxupabujabxldxy... |
user output |
---|
aaoaalguzaooyaoqxdkhapbvaposax... Truncated |
Test 57
Verdict: WRONG ANSWER
input |
---|
1000 a aa aaabaaaaf aaaeb ... |
correct output |
---|
aaaaaabaaaafaaaebaabeadaabfffd... |
user output |
---|
aaaaecafbeddcaeccaedbfedaeddfe... Truncated |
Test 58
Verdict: WRONG ANSWER
input |
---|
1000 a aamuthxggq abnfxhutgk adaumgqm ... |
correct output |
---|
aaamuthxggqabnfxhutgkadaumgqma... |
user output |
---|
aanfuociljaamuthxggqanqmblveao... Truncated |
Test 59
Verdict: WRONG ANSWER
input |
---|
1000 a aa aaa aaaa ... |
correct output |
---|
aaaaaaaaaaaaaaaaaaaaaaaaaaabaa... |
user output |
---|
aaaaaaaaaaaaaaaaaaaaaabccaacbc... Truncated |
Test 60
Verdict: WRONG ANSWER
input |
---|
1000 a aanmhqqnpc ab abam ... |
correct output |
---|
aaanmhqqnpcababamabginwqvvacba... |
user output |
---|
aanmaanmhqqnpcansuqraoskdirkrl... Truncated |
Test 61
Verdict: WRONG ANSWER
input |
---|
1000 a aa aaaca aae ... |
correct output |
---|
aaaaaacaaaeaaekcaagjeahdaahhdf... |
user output |
---|
aaaaghgaekifkaghccdbaggkaggbaj... Truncated |
Test 62
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 a aa aaa aaaagle ... |
correct output |
---|
aaaaaaaaaagleaaabaaabiaaaaccgh... |
user output |
---|
(empty) |
Test 63
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 a aa aaa aaaagf ... |
correct output |
---|
aaaaaaaaaagfaaaaihlblgaaaalkll... |
user output |
---|
(empty) |
Test 64
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 a aa aaa aaaa ... |
correct output |
---|
aaaaaaaaaaaaaabkaaaaelbjbaaaaf... |
user output |
---|
(empty) |
Test 65
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 a aa aaa aaaa ... |
correct output |
---|
aaaaaaaaaaaaaahleaaaajaaabaaab... |
user output |
---|
(empty) |
Test 66
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 a aa aaa aaacxrqz ... |
correct output |
---|
aaaaaaaaacxrqzaaahaaaahaaaplto... |
user output |
---|
(empty) |
Test 67
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 a aa aaa aaaa ... |
correct output |
---|
aaaaaaaaaaaaaaaaaaaaaadbaaaaaa... |
user output |
---|
(empty) |
Test 68
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 a aa aaa aaail ... |
correct output |
---|
aaaaaaaaailaaaitehaeaaaitxaaam... |
user output |
---|
(empty) |
Test 69
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 a aa aaa aaaa ... |
correct output |
---|
aaaaaaaaaaaaaaabghaaaabcaffaaa... |
user output |
---|
(empty) |
Test 70
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 a aa aaa aaaaggo ... |
correct output |
---|
aaaaaaaaaaggoaaacwpgjkvaaaftbl... |
user output |
---|
(empty) |
Test 71
Verdict: TIME LIMIT EXCEEDED
input |
---|
100000 a aa aaa aaaa ... |
correct output |
---|
aaaaaaaaaaaaaabaaaagkaaabaaabb... |
user output |
---|
(empty) |