CSES - Putka Open 2015 – finaali - Results
Submission details
Task:Sanat
Sender:
Submission time:2015-12-20 16:24:10 +0200
Language:C++
Status:READY
Result:52
Feedback
groupverdictscore
#1ACCEPTED52
Test results
testverdicttimescore
#1ACCEPTED0.20 s52details

Compiler report

input/code.cpp: In function 'bool en(std::string)':
input/code.cpp:9: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:11:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for (int i=0; i<s.size(); ++i){
                  ^
input/code.cpp:12:13: warning: array subscript has type 'char' [-Wchar-subscripts]
     ++z[s[i]];
             ^

Code

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

int z[255];
bool en(string s){
  for (int i=0; i<255; ++i) z[i]=0;
  
  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
10-4
10-4
...