CSES - Putka Open 2015 – finaali - Results
Submission details
Task:Sanat
Sender:
Submission time:2015-12-21 10:36:30 +0200
Language:C++
Status:COMPILE ERROR

Compiler report

input/code.cpp: In function 'bool ien(std::string)':
input/code.cpp:19:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0; i<s.size(); ++i)++z[s[i]];
                  ^
input/code.cpp:19:41: warning: array subscript has type 'char' [-Wchar-subscripts]
   for (int i=0; i<s.size(); ++i)++z[s[i]];
                                         ^
input/code.cpp:22:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=1; i<s.size(); ++i){
                  ^
input/code.cpp:25:96: error: expected ')' before 'return'
     if (a==b && (a=='a' || a=='i' || a=='k' || a=='l' || a=='m' || a=='n' || a=='p' || a=='s') return 0;
                                                                                                ^

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';
}


bool ien(string s){
  if (!vw(s[0]) && !vw(s[1])) return 1;
  if (!vw(s[s.size()-1])) return 1;
  
  for (int i='a'; i<='z'; ++i) z[i]=0;
  for (int i=0; i<s.size(); ++i)++z[s[i]];
  if (z['c'] || z['q'] || z['w'] || z['x'] || z['z']) return 1;
  
  for (int i=1; i<s.size(); ++i){
    char a=s[i-1];
    char b=s[i];
    if (a==b && (a=='a' || a=='i' || a=='k' || a=='l' || a=='m' || a=='n' || a=='p' || a=='s') return 0;
  }
  
  if (z['b'] || z['d'] || z['f'] || z['g']) return 1;
  if (z['y'] && (z['a'] || z['o'] || z['u'])) return 1;
  char kv=s[s.size()-3];
  if (s[s.size()-1]=='e' && (kv=='u' || kv=='i')) return 1;
  return 0;
}

int main(){
  
  cin >> n;
  for (int i=0; i<n; ++i){
    string s;
    cin >> s;
    if (ien(s)) cout << "QAQ\n";
    else cout << "10-4\n";
  }
}