Submission #2998742


Source Code Expand

#include <iostream>
#include <vector>

using ll = long long;
using namespace std;

int main() {
    int t;
    int c = 0, time = 0;
    vector<int> v;
    cin >> t;
    for (int i = 0; i < t; ++i) {
        string s;
        cin >> s;
        v.clear();
        if(s.length()<5) {cout << "0\n"; continue;}
        for (unsigned int j = 0; j < s.length()-4; ++j) {
            if (s.substr(j, 5) == "kyoto") v.emplace_back(j);
            else if (s.substr(j, 5) == "tokyo") v.emplace_back(j);
        }
        c = 0, time = 0;
        for (auto &&a : v) {
            if(time <= a){
                c++;
                time = a+5;
            }
        }
        cout << c << "\n";
    }
    return 0;
}

Submission Info

Submission Time
Task A - 東京都
User firiexp
Language C++14 (GCC 5.4.1)
Score 100
Code Size 737 Byte
Status AC
Exec Time 3 ms
Memory 256 KB

Judge Result

Set Name All
Score / Max Score 100 / 100
Status
AC × 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 AC 3 ms 256 KB
20_noised_tokyoto.txt AC 3 ms 256 KB
99_teuchi.txt AC 2 ms 256 KB