Submission #533053


Source Code Expand

#include "bits/stdc++.h"
using namespace std;

#define REP(i, n) for(int i=0; i<(n); i++)
#define ALL(a) (a).begin(),(a).end()

int N,T;
string S;
signed main()
{
    cin >> T;
    REP(i,T) {
        cin >> S;
        unsigned long long loc = S.find("tokyo", 0);
        vector<long long> ts;
        while(loc != string::npos) {
            ts.push_back(loc);
            loc = S.find("tokyo", loc + 5);
        }
        loc = S.find("kyoto", 0);
        while(loc != string::npos) {
            ts.push_back(loc);
            loc = S.find("kyoto", loc + 5);
        }
        sort(ALL(ts));
        int cnt = 0;
        int pre = -10;
        REP(j,ts.size()) {
            int k = ts[j];
            if (pre + 5 > k) {
                continue;
            }
            cnt++;
            pre = k;
        }
        cout << cnt << endl;
    }
    return 0;
}

Submission Info

Submission Time
Task A - 東京都
User kyproject
Language C++11 (GCC 4.9.2)
Score 100
Code Size 903 Byte
Status AC
Exec Time 26 ms
Memory 928 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 26 ms 928 KB
20_noised_tokyoto.txt AC 24 ms 920 KB
99_teuchi.txt AC 23 ms 676 KB