Submission #19482512


Source Code Expand

Copy
N;
char S[3<<17];
main(){
  scanf("%d%s",&N,S);
  int Wc=0,Ec=0;
  for(int i=0;i<N;i++)if(S[i]=='E')Ec++;
  int ans=1e9;
  for(int i=0;i<N;i++){
    if(S[i]=='E')Ec--;
    if(ans>Ec+Wc)ans=Ec+Wc;
    if(S[i]=='W')Wc++;
  }
  printf("%d\n",ans);
}

Submission Info

Submission Time
Task C - Attention
User kotatsugame
Language C (GCC 9.2.1)
Score 300
Code Size 246 Byte
Status AC
Exec Time 5 ms
Memory 1980 KB

Compile Error

./Main.c:1:1: warning: data definition has no type or storage class
    1 | N;
      | ^
./Main.c:1:1: warning: type defaults to ‘int’ in declaration of ‘N’ [-Wimplicit-int]
./Main.c:3:1: warning: return type defaults to ‘int’ [-Wimplicit-int]
    3 | main(){
      | ^~~~
./Main.c: In function ‘main’:
./Main.c:4:3: warning: implicit declaration of function ‘scanf’ [-Wimplicit-function-declaration]
    4 |   scanf("%d%s",&N,S);
      |   ^~~~~
./Main.c:4:3: warning: incompatible implicit declaration of built-in function ‘scanf’
./Main.c:1:1: note: include ‘<stdio.h>’ or provide a declaration of ‘scanf’
  +++ |+#include <stdio.h>
    1 | N;
./Main.c:13:3: warning: implicit declaration of function ‘printf’ [-Wimplicit-function-declaration]
   13 |   printf("%d\n",ans);
      |   ^~~~~~
./Main.c:13:3: warning: incompatible implicit declaration of built-in function ‘printf’
./Main.c:13:3: note: include ‘<stdio.h>’ or provide a declaration of ‘printf’

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 26
Set Name Test Cases
Sample sample_01.txt, sample_02.txt, sample_03.txt
All sample_01.txt, sample_02.txt, sample_03.txt, sample_01.txt, sample_02.txt, sample_03.txt, subtask_1_01.txt, subtask_1_02.txt, subtask_1_03.txt, subtask_1_04.txt, subtask_1_05.txt, subtask_1_06.txt, subtask_1_07.txt, subtask_1_08.txt, subtask_1_09.txt, subtask_1_10.txt, subtask_1_11.txt, subtask_1_12.txt, subtask_1_13.txt, subtask_1_14.txt, subtask_1_15.txt, subtask_1_16.txt, subtask_1_17.txt, subtask_1_18.txt, subtask_1_19.txt, subtask_1_20.txt
Case Name Status Exec Time Memory
sample_01.txt AC 4 ms 1636 KB
sample_02.txt AC 1 ms 1692 KB
sample_03.txt AC 1 ms 1608 KB
subtask_1_01.txt AC 5 ms 1900 KB
subtask_1_02.txt AC 1 ms 1652 KB
subtask_1_03.txt AC 2 ms 1792 KB
subtask_1_04.txt AC 4 ms 1788 KB
subtask_1_05.txt AC 2 ms 1736 KB
subtask_1_06.txt AC 4 ms 1980 KB
subtask_1_07.txt AC 4 ms 1912 KB
subtask_1_08.txt AC 3 ms 1896 KB
subtask_1_09.txt AC 2 ms 1868 KB
subtask_1_10.txt AC 5 ms 1916 KB
subtask_1_11.txt AC 5 ms 1900 KB
subtask_1_12.txt AC 5 ms 1892 KB
subtask_1_13.txt AC 5 ms 1904 KB
subtask_1_14.txt AC 4 ms 1896 KB
subtask_1_15.txt AC 4 ms 1940 KB
subtask_1_16.txt AC 4 ms 1944 KB
subtask_1_17.txt AC 5 ms 1932 KB
subtask_1_18.txt AC 4 ms 1896 KB
subtask_1_19.txt AC 3 ms 1900 KB
subtask_1_20.txt AC 4 ms 1980 KB