CSES - Putka Open 2015 – finaali - Results
Submission details
Task:Sanat
Sender:OOliOO
Submission time:2015-12-20 14:31:42 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
Test results
testverdicttimescore
#1--0details

Compiler report

input/code.cpp: In function 'bool contains(std::string, std::string)':
input/code.cpp:31:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<s.size()-pattern.size()+1; i++)
                   ^
input/code.cpp: In function 'int main()':
input/code.cpp:57:19: warning: suggest explicit braces to avoid ambiguous 'else' [-Wparentheses]
                 if(!vokaali(c))
                   ^

Code

#include <iostream>
#include <vector>
#include <stack>
#include <queue>
#include <algorithm>
#include <cmath>
#include <iomanip>
#include <unordered_set>
#include <stdio.h>
#include <string.h>
#include <unordered_map>
#include <fstream>
#include <set>
#include <map>

#define MOD 1000000007
#define ll long long
//#define N (1<<50)
#define float double
#define str string

using namespace std;

bool vokaali(char c){
    return (c=='a')||(c=='e')||(c=='i')||(c=='o')||(c=='u')||(c=='y');
}

bool contains(string s, string pattern){
    if(pattern.size()>s.size())
        return false;
    for(int i=0; i<s.size()-pattern.size()+1; i++)
        if(s.substr(i,pattern.size())==pattern)
            return true;
    return false;
}

int main(){
    int n=0;
    cin>>n;

    for(int i=0; i<n; i++){
        int s=0,e=0;
        string str;
        cin>>str;
        int l=str.size();

        if(vokaali(str[l-1]))
            s+=5;
        else
            e+=5;

        for(char c='a'; c<='z'; c++)
            if(c!='s'&&c!='c'&&c!='t'){
                std::string p;
                p+=c;
                p+=c;
                if(!vokaali(c))
                    if(contains(str.substr(0,str.length()-1), p))
                        s+=10;
                else
                    if(contains(str.substr(0,str.length()), p))
                        s+=10;
            }

        if(contains(str,"w"))
            e+=5;
        if(contains(str,"z"))
            e+=5;
        if(contains(str,"b"))
            e+=5;
        if(contains(str,"q"))
            e+=5;
        if(contains(str,"c"))
            e+=5;
        if(contains(str,"x"))
            e+=5;

        if(contains(str,"ch"))
            e+=10;
        if(contains(str,"gn"))
            e+=10;
        if(contains(str,"ck"))
            e+=10;

        if(e>=s)
            cout<<"QAQ"<<endl;
        else
            cout<<"10-4"<<endl;
    }
    return 0;
}

Test details

Test 1

Verdict:

input
95000
pursua
zoomata
mantelilastu
jamming
...

correct output
10-4
10-4
10-4
QAQ
QAQ
...

user output
(empty)