Submission #1793913


Source Code Expand

#include <iostream>
#include <iomanip> // << fixed << setprecision(xxx)
#include <algorithm> // do { } while ( next_permutation(A, A+xxx) ) ;
#include <vector>
#include <string> // to_string(nnn) // substr(m, n) // stoi(nnn)
#include <complex>
#include <tuple> // get<n>(xxx)
#include <queue>
#include <stack>
#include <map> // if (M.find(key) != M.end()) { }
#include <set> // S.insert(M);
// if (S.find(key) != S.end()) { }
// for (auto it=S.begin(); it != S.end(); it++) { }
// auto it = S.lower_bound(M);
#include <random> // random_device rd; mt19937 mt(rd());
#include <cctype>
#include <cassert>
#include <cmath>
#include <cstdio>
#include <cstdlib> // atoi(xxx)
using namespace std;

#define DEBUG 0 // change 0 -> 1 if we need debug.
// insert #if<tab> by my emacs. #if DEBUG == 1 ... #end

typedef long long ll;

// const int dx[4] = {1, 0, -1, 0};
// const int dy[4] = {0, 1, 0, -1};

// const int C = 1e6+10;
// const ll M = 1000000007;

int main () {
  string S;
  cin >> S;
  int N = S.size();
  for (auto i = 0; i < N-1; ++i) {
    if (S[i] == S[i+1]) {
      cout << i+1 << " " << i+2 << endl;
      return 0;
    }
  }
  for (auto i = 0; i < N-2; ++i) {
    if (S[i] == S[i+2]) {
      cout << i+1 << " " << i+3 << endl;
      return 0;
    }
  }
  cout << "-1 -1" << endl;
}

Submission Info

Submission Time
Task D - Unbalanced
User kazunetakahashi
Language C++14 (GCC 5.4.1)
Score 400
Code Size 1344 Byte
Status AC
Exec Time 5 ms
Memory 512 KB

Judge Result

Set Name Sample Sub1 Sub2
Score / Max Score 0 / 0 200 / 200 200 / 200
Status
AC × 2
AC × 14
AC × 24
Set Name Test Cases
Sample 0_01, 0_02
Sub1 0_01, 0_02, 1_03, 1_04, 1_05, 1_06, 1_07, 1_08, 1_09, 1_10, 1_11, 1_12, 1_13, 1_14
Sub2 0_01, 0_02, 1_03, 1_04, 1_05, 1_06, 1_07, 1_08, 1_09, 1_10, 1_11, 1_12, 1_13, 1_14, 2_15, 2_16, 2_17, 2_18, 2_19, 2_20, 2_21, 2_22, 2_23, 2_24
Case Name Status Exec Time Memory
0_01 AC 1 ms 256 KB
0_02 AC 1 ms 256 KB
1_03 AC 1 ms 256 KB
1_04 AC 1 ms 256 KB
1_05 AC 1 ms 256 KB
1_06 AC 1 ms 256 KB
1_07 AC 1 ms 256 KB
1_08 AC 1 ms 256 KB
1_09 AC 1 ms 256 KB
1_10 AC 1 ms 256 KB
1_11 AC 1 ms 256 KB
1_12 AC 1 ms 256 KB
1_13 AC 1 ms 256 KB
1_14 AC 1 ms 256 KB
2_15 AC 4 ms 512 KB
2_16 AC 4 ms 512 KB
2_17 AC 5 ms 512 KB
2_18 AC 5 ms 512 KB
2_19 AC 5 ms 512 KB
2_20 AC 4 ms 512 KB
2_21 AC 4 ms 512 KB
2_22 AC 5 ms 512 KB
2_23 AC 5 ms 512 KB
2_24 AC 5 ms 512 KB