Submission #2152475


Source Code Expand

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

typedef pair<int,int> P;
int T;
string S;
vector<P> v;

int main(){
	cin >> T;
	for(int i=0;i<T;i++){
		cin >> S;
		for(int j=0;j<S.size()-4;j++){
			string s = S.substr(j,5);
			if(s=="kyoto" || s=="tokyo"){
				v.push_back(P(j+5,j));
			}			
		}
		sort(v.begin(),v.end());
		int ans = 0,last = -1;
		for(int j=0;j<v.size();j++){
			if(last<v[j].second){
				ans++;
				last = v[j].first;
			}
		}
		cout << ans << endl;
		v.clear();
	}
}

Submission Info

Submission Time
Task A - 東京都
User idsigma
Language C++14 (GCC 5.4.1)
Score 0
Code Size 590 Byte
Status RE
Exec Time 100 ms
Memory 512 KB

Judge Result

Set Name All
Score / Max Score 0 / 100
Status
WA × 2
RE × 1
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 RE 100 ms 512 KB