Submission details
Task:Nimionese
Sender:OOliOO_slayer
Submission time:2015-11-25 19:35:32 +0200
Language:C++
Status:READY
Result:
Test results
testverdicttime
#10.05 sdetails
#20.06 sdetails
#30.06 sdetails
#40.05 sdetails
#50.05 sdetails
#60.05 sdetails
#70.05 sdetails
#80.05 sdetails
#9ACCEPTED0.06 sdetails
#10ACCEPTED0.06 sdetails
#11ACCEPTED0.06 sdetails
#12ACCEPTED0.05 sdetails

Compiler report

input/code.cpp: In function 'bool is_hard(char)':
input/code.cpp:17:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < hard.size(); i++){
                      ^
input/code.cpp: In function 'int main()':
input/code.cpp:63:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < words.size(); i++){
                      ^
input/code.cpp:66:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < words.size(); i++){
                      ^
input/code.cpp:69:26: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int j = 0; j < word.size(); j++){
                          ^
input/code.cpp:77:22: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0; i < words.size(); i++){
                      ^
input/code.cpp: In function...

Code

#include <iostream>
#include <vector>
#include <string>
#include <algorithm>
#include <map>
#include <sstream>
#include <utility>
#include <set>
#include <iomanip>

using namespace std;
typedef long long LL;

string hard = "bcdgknpt";

bool is_hard(char c){
    for(int i = 0; i < hard.size(); i++){
        if(hard[i] == c) return true;
    }
    return false;
}

char nearest_hard(char c){
    char best_char;
    int best_dist = 1000;
    for(char h : hard){
        int dist = abs(c-h);
        if(dist < best_dist){
            best_dist = dist;
            best_char = h;
        }
    }
    return best_char;
}

string vowels = "aou";

char nearest_vowel(char c){
    char best_char;
    int best_dist = 1000;
    for(char h : vowels){
        int dist = abs(c-h);
        if(dist < best_dist){
            best_dist = dist;
            best_char = h;
        }
    }
    return best_char;
}

int main(){
    cin.tie(0);
    ios_base::sync_with_stdio(0);
    vector<string> words;
    while(true){
        string word; cin >> word;
        if(!cin.good()) break;
        word[0] = tolower(word[0]);
        words.push_back(word);
    }
       
    
    for(int i = 0; i < words.size(); i++){
        words[i][0] = nearest_hard(words[i][0]);
    }
    for(int i = 0; i < words.size(); i++){
        string& word = words[i];
        bool flag = false;
        for(int j = 0; j < word.size(); j++){
            if(word[j] == '-') flag = true;
            else if(flag && is_hard(word[j]))
                word[j] = nearest_hard(word[0]);
        
        }
    }
    
    for(int i = 0; i < words.size(); i++){
        string& word = words[i];
        if(is_hard(word.back())){
            word.push_back(nearest_vowel(word.back()));
            word.push_back('h');
//            word += nearest_hard(word.back()) + "h";
        }
    }
    string result;
    for(auto word : words){
        for(char c : word)
            if(c != '-') result += c;
        result += ' ';
    }
    result[0] = toupper(result[0]);
    cout << result << endl;
}















Test details

Test 1

Verdict:

input
Each hip-po dog hip hip Hooray

correct output
Dach gipgo dogah gipoh gipoh G...

user output
Dach gipgo dogah gipoh gipoh g...

Test 2

Verdict:

input
aa ab ac ad ae af ag ah ai aj ...

correct output
ba bbah bcah bdah be bf bgah b...

user output
Ba bbah bcah bdah be bf bgah b...

Test 3

Verdict:

input
axx bxx cxx dxx exx fxx gxx hx...

correct output
bxx bxx cxx dxx dxx gxx gxx gx...

user output
Bxx bxx cxx dxx dxx gxx gxx gx...

Test 4

Verdict:

input
bc-acb bd-adb bg-agb bk-akb bn...

correct output
bcabbah bdabbah bgabbah bkabba...

user output
Bcabbah bdabbah bgabbah bkabba...

Test 5

Verdict:

input
Hip-po Aip-pop cip-pop dip-pop...

correct output
Gipgo Bipbobah cipcocah dipdod...

user output
Gipgo bipbobah cipcocah dipdod...

Test 6

Verdict:

input
d d d d d d d d d d d d d d d ...

correct output
dah dah dah dah dah dah dah da...

user output
Dah dah dah dah dah dah dah da...

Test 7

Verdict:

input
Dad dad Dad dad dad dad dad da...

correct output
Dadah dadah Dadah dadah dadah ...

user output
Dadah dadah dadah dadah dadah ...

Test 8

Verdict:

input
dddddddddddddddddddddddddddddd...

correct output
dddddddddddddddddddddddddddddd...

user output
Dddddddddddddddddddddddddddddd...

Test 9

Verdict: ACCEPTED

input
Wpgliaku-uibagddilpynomsytuubi...

correct output
Tpgliakuuitatttiltytomsytuutil...

user output
Tpgliakuuitatttiltytomsytuutil...

Test 10

Verdict: ACCEPTED

input
Fsqn-ggoou-padnrosondpf-mtsjfs...

correct output
Gsqnggoougaggrosogggfmgsjfsagl...

user output
Gsqnggoougaggrosogggfmgsjfsagl...

Test 11

Verdict: ACCEPTED

input
Ojaivaeduuucykdclkyammbvozytuk...

correct output
Njaivaeduuucykdclkyammbvozytuk...

user output
Njaivaeduuucykdclkyammbvozytuk...

Test 12

Verdict: ACCEPTED

input
Uprtouo-nvnabbiedq-vzogovufjaa...

correct output
Tprtouotvtattietqvzotovufjaaee...

user output
Tprtouotvtattietqvzotovufjaaee...