Task: | Babaza Game |
Sender: | user1111 |
Submission time: | 2024-09-02 17:56:30 +0300 |
Language: | C++ (C++20) |
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 | WRONG ANSWER | 0.00 s | details |
#6 | ACCEPTED | 0.00 s | details |
#7 | WRONG ANSWER | 0.00 s | details |
#8 | WRONG ANSWER | 0.00 s | details |
#9 | WRONG ANSWER | 0.00 s | details |
#10 | WRONG ANSWER | 0.00 s | details |
#11 | ACCEPTED | 0.00 s | details |
#12 | WRONG ANSWER | 0.00 s | details |
#13 | WRONG ANSWER | 0.00 s | details |
#14 | WRONG ANSWER | 0.00 s | details |
Compiler report
input/code.cpp: In function 'bool babaza(std::string)': input/code.cpp:5:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 5 | for (int i = 0; i < a.length()-1; i++) { | ~~^~~~~~~~~~~~~~ input/code.cpp: In function 'int main()': input/code.cpp:17:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 17 | for (int i = 0; i < a.length(); i++) { | ~~^~~~~~~~~~~~ input/code.cpp:45:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare] 45 | for (int i = 0; i < a.length(); i++) { | ~~^~~~~~~~~~~~ input/code.cpp:56:23: warning: comparison of integ...
Code
#include <bits/stdc++.h> using namespace std; bool babaza(string a) { for (int i = 0; i < a.length()-1; i++) { if (a[i] == a[i+1]) return false; } return true; } int main() { string a,b; cin >> a >> b; string absdiff = a; string ldiff = a, rdiff = a; for (int i = 0; i < a.length(); i++) { absdiff[i] = abs(b[i] - a[i]); if (i%2) { ldiff[i] = b[i]; } else { rdiff[i] = b[i]; } } if (babaza(absdiff)) { cout << a << '\n'; cout << b << '\n'; return 0; } if (babaza(ldiff)) { cout << a << '\n'; cout << ldiff << '\n'; cout << b << '\n'; return 0; } if (babaza(rdiff)) { cout << a << '\n'; cout << rdiff << '\n'; cout << b << '\n'; return 0; } set<char> used = {}; for (int i = 0; i < a.length(); i++) { used.insert(a[i]); used.insert(b[i]); } char unused = 'A'; for (;;unused++) { if (!(used.contains(unused))) { break; } } cout << a << '\n'; for (int i = 0; i < a.length(); i++) { if (i%2) { ldiff[i] = unused; } } cout << ldiff << '\n'; for (int i = 0; i < a.length(); i++) { if (!(i%2)) { ldiff[i] = b[i]; } } cout << ldiff << '\n'; cout << b << '\n'; return 0; }
Test details
Test 1
Verdict: ACCEPTED
input |
---|
A B |
correct output |
---|
A B |
user output |
---|
A 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 AC BC BA |
Test 4
Verdict: ACCEPTED
input |
---|
ABC BCD |
correct output |
---|
ABC DBD DCD BCD |
user output |
---|
ABC AEC BED BCD |
Test 5
Verdict: WRONG ANSWER
input |
---|
AXYB CXYD |
correct output |
---|
AXYB CXYD |
user output |
---|
AXYB AXYD CXYD |
Test 6
Verdict: ACCEPTED
input |
---|
LMIJLF PAQBMH |
correct output |
---|
LMIJLF PMQJMF PAQBMH |
user output |
---|
LMIJLF LAIBLH PAQBMH |
Test 7
Verdict: WRONG ANSWER
input |
---|
PNIWLSLIH CRLVPUFHD |
correct output |
---|
PNIWLSLIH CNLWPSFID CRLVPUFHD |
user output |
---|
PNIWLSLIH CRLVPUFHD |
Test 8
Verdict: WRONG ANSWER
input |
---|
ZDYIAVTKL ZJKVXGAUM |
correct output |
---|
ZDYIAVTKL ZJYVAGTUL ZJKVXGAUM |
user output |
---|
ZDYIAVTKL ZJKVXGAUM |
Test 9
Verdict: WRONG ANSWER
input |
---|
FBIXISJH NXZIESMG |
correct output |
---|
FBIXISJH NBZXESMH NXZIESMG |
user output |
---|
FBIXISJH NXZIESMG |
Test 10
Verdict: WRONG ANSWER
input |
---|
OPGW QJIE |
correct output |
---|
OPGW QPIW QJIE |
user output |
---|
OPGW QJIE |
Test 11
Verdict: ACCEPTED
input |
---|
DUKNPKQZBL NZPBMOEBIC |
correct output |
---|
DUKNPKQZBL NUPNMKEZIL NZPBMOEBIC |
user output |
---|
DUKNPKQZBL NUPNMKEZIL NZPBMOEBIC |
Test 12
Verdict: WRONG ANSWER
input |
---|
ZWDTX HZOXI |
correct output |
---|
ZWDTX HWOTI HZOXI |
user output |
---|
ZWDTX HZOXI |
Test 13
Verdict: WRONG ANSWER
input |
---|
URJF ITIQ |
correct output |
---|
URJF IRIF ITIQ |
user output |
---|
URJF ITIQ |
Test 14
Verdict: WRONG ANSWER
input |
---|
WYWBWU IRYVBA |
correct output |
---|
WYWBWU WRWVWA IRYVBA |
user output |
---|
WYWBWU IRYVBA |