CSES - Putka Open 2015 – finaali - Results
Submission details
Task:Neliöt
Sender:OOliOO
Submission time:2015-12-20 16:35:24 +0200
Language:C++
Status:READY
Result:0
Feedback
groupverdictscore
#10
#20
#30
Test results
testverdicttimegroup
#10.23 s1details
#20.38 s2details
#30.74 s3details

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 max_k(std::string)':
input/code.cpp:41:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<s.size(); i++){
                   ^
input/code.cpp: In function 'int max_v(std::string)':
input/code.cpp:57:19: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i=0; i<s.size(); i++){
                   ^
input/code.cpp: In function 'int main()':
input/code.cpp:98:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
         for(int i=0; i<str.size(); i++)
                       ^
input/code.cpp:120:23: warning: comparison between signed and unsigned integer expressions [-Wsign...

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 max_k(string s){
    int M=0;
    int cur=0;

    for(int i=0; i<s.size(); i++){
        if(vokaali(s[i]))
            cur=0;
        else{
            cur++;
            M=max(M,cur);
        }
    }
    return M;
}


int max_v(string s){
    int M=0;
    int cur=0;

    for(int i=0; i<s.size(); i++){
        if(!vokaali(s[i]))
            cur=0;
        else{
            cur++;
            M=max(M,cur);
        }
    }
    return M;
}

char ps[256],pe[256];

int main(){
    pe['q']+=5;
    pe['w']+=5;
    pe['d']+=5;
    pe['f']+=5;
    pe['g']+=5;
    pe['z']+=5;
    pe['x']+=5;
    pe['c']+=5;
    pe['b']+=5;

    cin.sync_with_stdio(false);
    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;


        int vc=0;
        for(int i=0; i<str.size(); i++)
            if(vokaali(str[i]))
                vc++;

        if(vc*1./str.size()>0.4)
            s++;
        if(max_v(str)>=2)
            s+=5;

        if(contains(str, "aa"))
            s+=10;
        if(contains(str, "kk"))
            s+=10;
        if(contains(str, "pp"))
            s+=10;
        if(contains(str, "ee"))
            s+=10;
        if(contains(str, "uu"))
            s+=10;
        if(contains(str, "tt"))
            s+=10;

        for(int i=0; i<str.size(); i++)
            e+=pe[str[i]];

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


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

Test details

Test 1

Group: 1

Verdict:

input
100000
6 9 3 3
1 3 1 1
3 3 6 9
2 2 4 4
...

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

user output
QAQ
QAQ
QAQ
QAQ
QAQ
...

Test 2

Group: 2

Verdict:

input
100000
270 90 90 90
372 914 438 84
304 152 152 304
238 238 714 238
...

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

user output
QAQ
QAQ
QAQ
QAQ
QAQ
...

Test 3

Group: 3

Verdict:

input
100000
821863964 821863964 821863964 ...

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

user output
QAQ
QAQ
QAQ
QAQ
QAQ
...