CSES - Putka Open 2015 – finaali - Results
Submission details
Task:Sanat
Sender:
Submission time:2015-12-21 10:25:29 +0200
Language:C++
Status:READY
Result:60
Feedback
groupverdictscore
#1ACCEPTED60
Test results
testverdicttimescore
#1ACCEPTED0.19 s60details

Compiler report

input/code.cpp: In function 'bool ien(std::string)':
input/code.cpp:18: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:18:42: warning: array subscript has type 'char' [-Wchar-subscripts]
   for (int i=0; i<s.size(); ++i) ++z[s[i]];
                                          ^
input/code.cpp:22:8: warning: unused variable 'kv' [-Wunused-variable]
   char kv=s[s.size()-3];
        ^

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['b'] || z['c'] || z['d'] || z['f'] || z['g'] || z['q'] || z['w'] || z['x'] || z['z']) 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";
  }
}

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
...