Submission #3699942


Source Code Expand

#include <algorithm>
#include <bitset>
#include <cctype>
#include <chrono>
#include <cmath>
#include <cstdio>
#include <ctime>
#include <deque>
#include <iostream>
#include <map>
#include <queue>
#include <random>
#include <string>
#include <unordered_map>
#include <vector>
using namespace std;

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

const int INF = 0x3f3f3f3f;
const long long LINF = 0x3f3f3f3f3f3f3f3fLL;
/*----------------------------------------*/

int main() {
  cin.tie(0); ios::sync_with_stdio(false);
  // freopen("input.txt", "r", stdin);

  int t; cin >> t;
  vector<string> str(t); REP(i, t) cin >> str[i];
  REP(i, t) {
    int ans = 0;
    int tokyo = str[i].find("tokyo"), kyoto = str[i].find("kyoto");
    while (tokyo != str[i].npos || kyoto != str[i].npos) {
      ++ans;
      if (tokyo != str[i].npos && kyoto != str[i].npos) {
        if (tokyo < kyoto) {
          tokyo = str[i].find("tokyo", tokyo + 5);
          kyoto = str[i].find("kyoto", tokyo + 5);
        } else {
          tokyo = str[i].find("tokyo", kyoto + 5);
          kyoto = str[i].find("kyoto", kyoto + 5);
        }
      } else if (tokyo != str[i].npos) {
        tokyo = str[i].find("tokyo", tokyo + 5);
      } else {
        kyoto = str[i].find("kyoto", kyoto + 5);
      }
    }
    cout << ans << "\n";
  }
  return 0;
}

Submission Info

Submission Time
Task A - 東京都
User emthrm
Language C++14 (GCC 5.4.1)
Score 0
Code Size 1445 Byte
Status WA
Exec Time 1 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 1 ms 256 KB
20_noised_tokyoto.txt WA 1 ms 256 KB
99_teuchi.txt WA 1 ms 256 KB