Task: | Babaza Game |
Sender: | odanobunaga8199 |
Submission time: | 2024-09-02 17:40:54 +0300 |
Language: | C++ (C++20) |
Status: | READY |
Result: | WRONG ANSWER |
test | verdict | time | |
---|---|---|---|
#1 | WRONG ANSWER | 0.00 s | details |
#2 | ACCEPTED | 0.00 s | details |
#3 | ACCEPTED | 0.00 s | details |
#4 | ACCEPTED | 0.00 s | details |
#5 | WRONG ANSWER | 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 | ACCEPTED | 0.00 s | details |
#12 | ACCEPTED | 0.00 s | details |
#13 | ACCEPTED | 0.00 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
Code
#include <iostream> #include <string> using namespace std; string combine_and_replace(string odd, string even, char temp_char, string s) { string result = ""; for (size_t i = 0; i < odd.length() + even.length(); ++i) { result += (i % 2 == 0) ? odd[i/2] : even[i/2]; if (i > 0 && result[i] == result[i - 1]) { if (i%2 == 0) { result[i] = temp_char; } else { result[i-1] = temp_char; } } } return result; } int main() { string s1, s2; cin >> s1 >> s2; string s1_odd, s1_even, s2_odd, s2_even; for (size_t i = 0; i < s1.length(); ++i) { if (i % 2 == 0) { s1_odd += s1[i]; s2_odd += s2[i]; } else { s1_even += s1[i]; s2_even += s2[i]; } } char temp_char = 'A'; for (; temp_char <= 'Z'; ++temp_char) { if (s1.find(temp_char) == string::npos && s2.find(temp_char) == string::npos) { break; } } cout << s1 << endl; s1_odd = s2_odd; s1 = combine_and_replace(s1_odd, s1_even, temp_char, "odd"); cout << s1 << endl; s1_odd = ""; s1_even = ""; for (size_t i = 0; i < s1.length(); ++i) { if (i % 2 == 0) { s1_odd += s1[i]; } else { s1_even += s1[i]; } } s1_even = s2_even; s1 = combine_and_replace(s1_odd, s1_even, temp_char, "even"); cout << s1 << endl; if (s1 != s2) { cout << s2; } return 0; }
Test details
Test 1
Verdict: WRONG ANSWER
input |
---|
A B |
correct output |
---|
A B |
user output |
---|
A B B |
Test 2
Verdict: ACCEPTED
input |
---|
BABAZA BACBCB |
correct output |
---|
BABAZA BACACA BACBCB |
user output |
---|
BABAZA BACACA BACBCB |
Test 3
Verdict: ACCEPTED
input |
---|
AB BA |
correct output |
---|
AB CB CA BA |
user output |
---|
AB CB CA BA |
Test 4
Verdict: ACCEPTED
input |
---|
ABC BCD |
correct output |
---|
ABC DBD DCD BCD |
user output |
---|
ABC EBD ECD BCD |
Test 5
Verdict: WRONG ANSWER
input |
---|
AXYB CXYD |
correct output |
---|
AXYB CXYD |
user output |
---|
AXYB CXYB CXYD |
Test 6
Verdict: ACCEPTED
input |
---|
LMIJLF PAQBMH |
correct output |
---|
LMIJLF PMQJMF PAQBMH |
user output |
---|
LMIJLF PMQJMF PAQBMH |
Test 7
Verdict: ACCEPTED
input |
---|
PNIWLSLIH CRLVPUFHD |
correct output |
---|
PNIWLSLIH CNLWPSFID CRLVPUFHD |
user output |
---|
PNIWLSLIH CNLWPSFID CRLVPUFHD |
Test 8
Verdict: ACCEPTED
input |
---|
ZDYIAVTKL ZJKVXGAUM |
correct output |
---|
ZDYIAVTKL ZJYVAGTUL ZJKVXGAUM |
user output |
---|
ZDYIAVTKL ZDKIXVAKM ZJKVXGAUM |
Test 9
Verdict: ACCEPTED
input |
---|
FBIXISJH NXZIESMG |
correct output |
---|
FBIXISJH NBZXESMH NXZIESMG |
user output |
---|
FBIXISJH NBZXESMH NXZIESMG |
Test 10
Verdict: ACCEPTED
input |
---|
OPGW QJIE |
correct output |
---|
OPGW QPIW QJIE |
user output |
---|
OPGW QPIW QJIE |
Test 11
Verdict: ACCEPTED
input |
---|
DUKNPKQZBL NZPBMOEBIC |
correct output |
---|
DUKNPKQZBL NUPNMKEZIL NZPBMOEBIC |
user output |
---|
DUKNPKQZBL NUPNMKEZIL NZPBMOEBIC |
Test 12
Verdict: ACCEPTED
input |
---|
ZWDTX HZOXI |
correct output |
---|
ZWDTX HWOTI HZOXI |
user output |
---|
ZWDTX HWOTI HZOXI |
Test 13
Verdict: ACCEPTED
input |
---|
URJF ITIQ |
correct output |
---|
URJF IRIF ITIQ |
user output |
---|
URJF IRIF ITIQ |
Test 14
Verdict: WRONG ANSWER
input |
---|
WYWBWU IRYVBA |
correct output |
---|
WYWBWU WRWVWA IRYVBA |
user output |
---|
WYWBWU IYCBCU IRCVCA IRYVBA |