Submission #1177024


Source Code Expand

#include<stdio.h>
#define MAX 100005

int main(){
  char s[MAX],*p;
  fread(s,sizeof(char),MAX,stdin);
  p=s;
  
  while(*p!='\n'){
    //  printf("%c , %c , %c\n",*p,*(p+1),*(p+2));
    if(*p==*(p+1)){
      printf("%d %d\n",&*p-s+1,&*p-s+2);
      return 0;
    }
    if(*p==*(p+2)){
      printf("%d %d\n",&*p-s+1,&*p-s+3);
      return 0;
    }
    
    *p++;
  }
  puts("-1 -1");
}

Submission Info

Submission Time
Task D - Unbalanced
User hanada3355
Language C (GCC 5.4.1)
Score 400
Code Size 408 Byte
Status AC
Exec Time 1 ms
Memory 256 KB

Compile Error

./Main.c: In function ‘main’:
./Main.c:12:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
       printf("%d %d\n",&*p-s+1,&*p-s+2);
              ^
./Main.c:12:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
./Main.c:16:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 2 has type ‘long int’ [-Wformat=]
       printf("%d %d\n",&*p-s+1,&*p-s+3);
              ^
./Main.c:16:14: warning: format ‘%d’ expects argument of type ‘int’, but argument 3 has type ‘long int’ [-Wformat=]
./Main.c:6:3: warning: ignoring return value of ‘fread’, declared with attribute warn_unused_result [-Wunused-result]
   fread(s,sizeof(char),MAX,stdin);
   ^

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 0 ms 128 KB
0_02 AC 0 ms 128 KB
1_03 AC 0 ms 128 KB
1_04 AC 0 ms 128 KB
1_05 AC 0 ms 128 KB
1_06 AC 0 ms 128 KB
1_07 AC 0 ms 128 KB
1_08 AC 0 ms 128 KB
1_09 AC 0 ms 128 KB
1_10 AC 0 ms 128 KB
1_11 AC 0 ms 128 KB
1_12 AC 0 ms 128 KB
1_13 AC 0 ms 128 KB
1_14 AC 0 ms 128 KB
2_15 AC 1 ms 256 KB
2_16 AC 1 ms 256 KB
2_17 AC 1 ms 256 KB
2_18 AC 1 ms 256 KB
2_19 AC 1 ms 256 KB
2_20 AC 1 ms 256 KB
2_21 AC 1 ms 256 KB
2_22 AC 1 ms 256 KB
2_23 AC 1 ms 256 KB
2_24 AC 1 ms 256 KB