提出 #58658481


ソースコード 拡げる

// LUOGU_RID: 181572679
#include<bits/stdc++.h>
#define int long long
#define pb push_back
namespace IO {
    #define int long long 
    #define gh getchar
    inline int read(){char ch=gh();int x=0;bool t=0;while(ch<'0'||ch>'9')   t|=ch=='-',ch=gh();while(ch>='0'&&ch<='9') x=x*10+(ch^48),ch=gh();return t?-x:x;}
    inline char getc(){char ch=gh();while(ch<'a'||ch>'z') ch=gh();return ch;}
    inline void write(int x){if(x < 0){putchar('-');x = -x;}if(x > 9){write(x / 10);}putchar((x % 10 + '0'));}
}
using namespace IO;
using namespace std;
const int Maxn = 100010, mod = 1e8;

signed main(){
    string s;
    cin >> s;
    int n = s.size();
    s = ' ' + s;
    for(int i = 1; i < n; i++){
        if(s[i] == s[i + 1]) {
            cout << i << ' ' << i + 1 << endl; return 0;
        }
    }
    for(int i = 1; i < n - 1; i++){
        if(s[i] == s[i + 2]) {
            cout << i << ' ' << i + 2 << endl; return 0;
        }
    }
    cout << "-1 -1" << endl;
}

提出情報

提出日時
問題 D - アンバランス
ユーザ TheShuMo
言語 C++ 17 (gcc 12.2)
得点 400
コード長 1001 Byte
結果 AC
実行時間 2 ms
メモリ 3864 KiB

ジャッジ結果

セット名 Sample Sub1 Sub2
得点 / 配点 0 / 0 200 / 200 200 / 200
結果
AC × 2
AC × 14
AC × 24
セット名 テストケース
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
ケース名 結果 実行時間 メモリ
0_01 AC 1 ms 3488 KiB
0_02 AC 1 ms 3472 KiB
1_03 AC 1 ms 3528 KiB
1_04 AC 1 ms 3504 KiB
1_05 AC 1 ms 3456 KiB
1_06 AC 1 ms 3536 KiB
1_07 AC 1 ms 3500 KiB
1_08 AC 1 ms 3364 KiB
1_09 AC 1 ms 3568 KiB
1_10 AC 1 ms 3496 KiB
1_11 AC 1 ms 3568 KiB
1_12 AC 1 ms 3436 KiB
1_13 AC 1 ms 3536 KiB
1_14 AC 1 ms 3572 KiB
2_15 AC 2 ms 3708 KiB
2_16 AC 2 ms 3708 KiB
2_17 AC 2 ms 3676 KiB
2_18 AC 2 ms 3704 KiB
2_19 AC 2 ms 3676 KiB
2_20 AC 2 ms 3648 KiB
2_21 AC 2 ms 3668 KiB
2_22 AC 2 ms 3780 KiB
2_23 AC 2 ms 3712 KiB
2_24 AC 2 ms 3864 KiB