Submission #2179432


Source Code Expand

#include <iostream>
#include <string>
#include <algorithm>
using namespace std;

int solve(string);
int main(){
  int t; cin >> t;
  for(int i=0; i<t; i++){
    string s; cin >> s;
    cout << solve(s) << endl;
  }

  return 0;
}

int solve(string s){
  string tokyo="tokyo", kyoto="kyoto";
  int tindex=0, kindex=0;
  for(int i=0; i<s.length(); i++){
    if(s[i]==tokyo[tindex%tokyo.length()]){
      tindex++;
    }
    if(s[i]==kyoto[kindex%kyoto.length()]){
      kindex++;
    }
  }
  return max(tindex/tokyo.length(), kindex/kyoto.length());
}

Submission Info

Submission Time
Task A - 東京都
User kobajin
Language C++14 (GCC 5.4.1)
Score 0
Code Size 579 Byte
Status WA
Exec Time 2 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 3
Set Name Test Cases
All 10_random_to_kyo.txt, 20_noised_tokyoto.txt, 99_teuchi.txt
Case Name Status Exec Time Memory
10_random_to_kyo.txt WA 2 ms 256 KB
20_noised_tokyoto.txt WA 2 ms 256 KB
99_teuchi.txt WA 1 ms 256 KB