CSES - Putka Open 2015 – finaali - Results
Submission details
Task:Sanat
Sender:
Submission time:2015-12-21 09:55:05 +0200
Language:C++
Status:READY
Result:72
Feedback
groupverdictscore
#1ACCEPTED72
Test results
testverdicttimescore
#1ACCEPTED0.22 s72details

Compiler report

input/code.cpp: In function 'bool ien(std::string)':
input/code.cpp:24:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0; i<fie.size(); ++i){
                  ^
input/code.cpp:26:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int j=0; j<fie[i].size(); ++j){
                    ^
input/code.cpp:31:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0; i<ene.size(); ++i){
                  ^
input/code.cpp:33:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int j=0; j<ene[i].size(); ++j){
                    ^
input/code.cpp:39:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0; i<s.size(); ++i){
                  ^
input/code.cpp:40:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for...

Code

#include <iostream>
#include <vector>
using namespace std;
int n;

int z[255];


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


vector<string> en;
vector<string> fi;

vector<string> ene;
vector<string> fie;


bool ien(string s){
  if (!vw(s[0]) && !vw(s[1])) return 1;
  
  for (int i=0; i<fie.size(); ++i){
    bool is=1;
    for (int j=0; j<fie[i].size(); ++j){
      if (fie[i][j]!=s[s.size()-fie[i].size()+j]){ is=0; break;}
    }
    if (is) return 0;
  }
  for (int i=0; i<ene.size(); ++i){
    bool is=1;
    for (int j=0; j<ene[i].size(); ++j){
      if (ene[i][j]!=s[s.size()-ene[i].size()+j]){ is=0; break;}
    }
    if (is) return 1;
  }
  
  for (int i=0; i<s.size(); ++i){
    for (int j=0; j<en.size(); ++j){
      if (i+en[j].size()>s.size()) continue;
      bool is=1;
      for (int k=0; k<en[j].size(); ++k){
        if (en[j][k]!=s[i+k]){
          is=0;
          break;
        }
      }
      if (is) return 1;
    }
    for (int j=0; j<fi.size(); ++j){
      if (i+fi[j].size()>s.size()) continue;
      bool is=1;
      for (int k=0; k<fi[j].size(); ++k){
        if (fi[j][k]!=s[i+k]){
          is=0;
          break;
        }        
      }
      if (is) return 0;
    }
  }
  
  return 0;
}

int main(){  
  en.push_back("th");
  en.push_back("ph");
  en.push_back("sh");
  en.push_back("ae");
  
  en.push_back("b");
  en.push_back("c");
  en.push_back("g");
  en.push_back("q");
  en.push_back("w");
  en.push_back("x");
  en.push_back("z");
  
  
  fi.push_back("aa");
  fi.push_back("au");
  fi.push_back("eu");
  fi.push_back("ei");
  fi.push_back("ai");
  fi.push_back("ii");
  fi.push_back("kk");
  fi.push_back("lk");
  fi.push_back("ll");
  fi.push_back("mm");
  fi.push_back("uo");
  fi.push_back("ou");
  fi.push_back("pp");
  fi.push_back("lp");
  fi.push_back("ln");
  
  ene.push_back("ng");
  ene.push_back("b");
  ene.push_back("c");
  ene.push_back("d");
  ene.push_back("f");
  ene.push_back("g");
  ene.push_back("h");
  ene.push_back("k");
  ene.push_back("l");
  ene.push_back("m");
  ene.push_back("p");
  ene.push_back("q");
  ene.push_back("r");
  ene.push_back("s");
  ene.push_back("t");
  ene.push_back("w");
  ene.push_back("x");
  ene.push_back("z");
  ene.push_back("ity");
  ene.push_back("lly");
  
  fie.push_back("nen");
  fie.push_back("sti");
;
  
  
  cin >> n;
  for (int i=0; i<n; ++i){
    string s;
    cin >> s;
    if (ien(s)) cout << "QAQ\n";
    else cout << "10-4\n";
  }
}

Test details

Test 1

Verdict: ACCEPTED

input
95000
pursua
zoomata
mantelilastu
jamming
...

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

user output
10-4
QAQ
10-4
QAQ
QAQ
...