Submission #2226318


Source Code Expand

using System;
using System.Collections.Generic;
using System.Linq;
class Program
{
    public static bool f = false, t = true;
    static void Main(string[] args)
    {
        string a = Read.Str();
        for (int i = 0; i < a.Length - 1; i++)
        {
            if (a[i] == a[i + 1]) { Console.WriteLine((i + 1) + " " + (i + 2));return; }
        }
        for (int i = 0; i < a.Length - 2; i++)
        {
            if (a[i] == a[i + 2]) { Console.WriteLine((i + 1) + " " + (i + 3)); return; }
        }
        Console.WriteLine("-1 -1");

    }
    public static long gcd(long a, long b)
    {
        while (true)
        {
            if (a == 0) { return b; }
            if (b == 0) { return a; }
            if (a > b) { a -= b; }
            else { b -= a; }
        }
    }
    public static long lcm(long a, long b) { return a / gcd(a, b) * b; }
    public static string Reverse(string s)
    {
        return new string(s.Reverse().ToArray());
    }
    public static bool IsPrime(int num)
    {
        if (num < 2) return false;
        else if (num == 2) return true;
        else if (num % 2 == 0) return false; // 偶数はあらかじめ除く

        double sqrtNum = Math.Sqrt(num);
        for (int i = 3; i <= sqrtNum; i += 2)
        {
            if (num % i == 0)
            {
                // 素数ではない
                return false;
            }
        }

        // 素数である
        return true;
    }
}
public static class Read
{
    public static void outl(string n = "") { Console.WriteLine(n); return; }
    public static long Long() { return long.Parse(Console.ReadLine()); }
    public static long[] longs() { return Console.ReadLine().Split().Select(long.Parse).ToArray(); }
    public static int Int() { return int.Parse(Console.ReadLine()); }
    public static int[] ints() { return Console.ReadLine().Split().Select(int.Parse).ToArray(); }
    public static string Str() { return Console.ReadLine(); }
    public static string[] Strs() { return Console.ReadLine().Split(); }
}

Submission Info

Submission Time
Task D - Unbalanced
User rayhotate
Language C# (Mono 4.6.2.0)
Score 400
Code Size 2107 Byte
Status AC
Exec Time 22 ms
Memory 11232 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 20 ms 9044 KB
0_02 AC 20 ms 11092 KB
1_03 AC 20 ms 11092 KB
1_04 AC 20 ms 11092 KB
1_05 AC 20 ms 9044 KB
1_06 AC 20 ms 9044 KB
1_07 AC 20 ms 11092 KB
1_08 AC 21 ms 11092 KB
1_09 AC 20 ms 11092 KB
1_10 AC 21 ms 11092 KB
1_11 AC 21 ms 9044 KB
1_12 AC 20 ms 9044 KB
1_13 AC 20 ms 11092 KB
1_14 AC 20 ms 9044 KB
2_15 AC 21 ms 9184 KB
2_16 AC 21 ms 11232 KB
2_17 AC 21 ms 11232 KB
2_18 AC 22 ms 11232 KB
2_19 AC 21 ms 11232 KB
2_20 AC 21 ms 9184 KB
2_21 AC 20 ms 9184 KB
2_22 AC 21 ms 11232 KB
2_23 AC 20 ms 9184 KB
2_24 AC 20 ms 9184 KB