CSES - Putka Open 2015 – finaali - Results
Submission details
Task:Sanat
Sender:
Submission time:2015-12-20 16:26:49 +0200
Language:C++
Status:READY
Result:62
Feedback
groupverdictscore
#1ACCEPTED62
Test results
testverdicttimescore
#1ACCEPTED0.20 s62details

Compiler report

input/code.cpp: In function 'bool en(std::string)':
input/code.cpp:14:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=1; i<s.size(); ++i) if (s[i]==s[i-1]) return 0;
                  ^
input/code.cpp:16:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0; i<s.size(); ++i){
                  ^
input/code.cpp:17:13: warning: array subscript has type 'char' [-Wchar-subscripts]
     ++z[s[i]];
             ^

Code

#include <iostream>
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 en(string s){
  for (int i=0; i<255; ++i) z[i]=0;
  if (!vw(s[s.size()-1])) return 1;
  for (int i=1; i<s.size(); ++i) if (s[i]==s[i-1]) return 0;
  
  for (int i=0; i<s.size(); ++i){
    ++z[s[i]];
  }
  if (z['b'] || z['c'] || z['d'] || z['g'] || z['q'] || z['w'] || z['x'] || z['z']) return 1;
  return 0;
}

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