CSES - Putka Open 2015 – finaali - Results
Submission details
Task:Sanat
Sender:Henrik Lievonen
Submission time:2015-12-20 14:43:20 +0200
Language:C++
Status:READY
Result:54
Feedback
groupverdictscore
#1ACCEPTED54
Test results
testverdicttimescore
#1ACCEPTED0.21 s54details

Code

// F

#include <iostream>
#include <string>

using namespace std;

bool iswovel(const char c) {
  switch (c) {
    case 'a':
    case 'e':
    case 'i':
    case 'o':
    case 'u':
    case 'y':
      return true;
    default:
      return false;
  }
}
bool isconsonant(const char c) {
  return !iswovel(c);
}
bool endswith(const string str, const string fix) {
  if (fix.size() > str.size())
    return false;
  return str.substr(str.size()-fix.size()) == fix;
}
bool contains(const string str, const string s) {
  return str.find(s) != string::npos;
}
bool startswithtwoconsonants(const string str) {
  return isconsonant(str[0]) && isconsonant(str[1]);
}
bool endswithtwoconsonants(const string str) {
  return isconsonant(str[str.size()-1]) && isconsonant(str[str.size()-2]);
}

bool testaa(const string sana) {
  if (startswithtwoconsonants(sana))
    return false;
  if (endswithtwoconsonants(sana))
    return false;
  if (endswith(sana, "nen"))
    return true;
  if (contains(sana, "ph"))
    return false;
  if (contains(sana, "ch"))
    return false;
  if (contains(sana, "f"))
    return false;
  if (contains(sana, "z"))
    return false;
  if (contains(sana, "q"))
    return false;
  if (contains(sana, "x"))
    return false;
  if (contains(sana, "ie"))
    return true;
  return true;
}

int main() {
  int n;
  cin >> n;
  for (int i = 0; i < n; i++) {
    string s;
    cin >> s;
    if (testaa(s))
      cout<<"10-4\n";
    else
      cout<<"QAQ\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
10-4
...