| Task: | HIIT Generation |
| Sender: | Robotiimi |
| Submission time: | 2018-05-26 11:49:14 +0300 |
| Language: | C++ |
| Status: | READY |
| Result: | WRONG ANSWER |
| test | verdict | time | |
|---|---|---|---|
| #1 | WRONG ANSWER | 0.02 s | details |
| #2 | WRONG ANSWER | 0.04 s | details |
| #3 | WRONG ANSWER | 0.01 s | details |
| #4 | ACCEPTED | 0.01 s | details |
Compiler report
input/code.cpp: In function 'int main()':
input/code.cpp:20:12: warning: suggest parentheses around comparison in operand of '&' [-Wparentheses]
if (i&1==0) {
~^~~
input/code.cpp:21:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int j=0; j<r1.size(); j++) {
~^~~~~~~~~~
input/code.cpp:30:24: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for (int j=0; j<r2.size(); j++) {
~^~~~~~~~~~Code
#include <bits/stdc++.h>
#include <string>
using namespace std;
int main() {
ios_base::sync_with_stdio(0);
cin.tie(0);
int n;
cin >> n;
string r1 = "HIIT";
string r2 = "HIIT";
char a;
char b;
for (int i=0; i<n; i++) {
cin >> a;
if (i&1==0) {
for (int j=0; j<r1.size(); j++) {
b = r1[j];
if (b==a) {
r2 += "HIIT";
} else {
r2 += b;
}
}
} else {
for (int j=0; j<r2.size(); j++) {
b = r2[j];
if (b==a) {
r1 += "HIIT";
} else {
r1 += b;
}
}
}
}
if (r1.size() < r2.size()) {
cout << r2 << "\n";
} else {
cout << r1 << "\n";
}
}
Test details
Test 1
Verdict: WRONG ANSWER
| input |
|---|
| 17 I I I I ... |
| correct output |
|---|
| HHHHHHHHHHHHHHHHHHIITHIITTHHII... |
| user output |
|---|
| HIITHHIITHIITTHHIITHIITTHHIITH... |
Test 2
Verdict: WRONG ANSWER
| input |
|---|
| 333332 H H H H ... |
| correct output |
|---|
| HIITIITIITIITIITIITIITIITIITII... |
| user output |
|---|
| HIITHIITIITHIITIITHIITIITHIITI... |
Test 3
Verdict: WRONG ANSWER
| input |
|---|
| 24 H T H T ... |
| correct output |
|---|
| HIIHIITIIHIIHIITIIHIITIIHIIHII... |
| user output |
|---|
| HIITHIITIITHIIHIITHIITIITHIIHI... |
Test 4
Verdict: ACCEPTED
| input |
|---|
| 0 |
| correct output |
|---|
| HIIT |
| user output |
|---|
| HIIT |
