Submission #6767

#TimeUsernameProblemLanguageResultExecution timeMemory
6767cki86201돌 옮기기 (GA7_stone)C++98
Compilation error
0 ms0 KiB
#include<stdio.h> #include<algorithm> #include<string.h> #include<vector> #include<math.h> #include<stdlib.h> #include<set> #include<ctype.h> using namespace std; #define X first #define Y second typedef long long ll; typedef pair<int,int> Pi; int c[800040]; int f[400020]; int main() int r, n; int i; scanf("%d%d",&r,&n); for(i=1;i<=2*n;i++){ char ch[2]; scanf("%*d%s",ch); c[i] = ch[0] == 'B'; } n = 2*n; for(i=1;i<=n;i++)c[i+n] = c[i]; int m = 2*n; f[0] = -1; for(i=1;i<=n;i++){ int x; for(x = f[i-1]+1;x;x = f[x-1]+1){ if(c[i] == c[x])break; } f[i] = x; } int j = 1; for(i=1;i<=m;i++,j++){ while(j && c[i] == c[j])j = f[j-1] + 1; if(j == n)break; } if(i-n == n+1)printf("-1"); else printf("%lld",(ll)r*(i-n)); return 0; }

Compilation message (stderr)

stone.cpp:21:2: error: expected initializer before 'int'
stone.cpp:23:7: error: expected constructor, destructor, or type conversion before '(' token
stone.cpp:24:2: error: expected unqualified-id before 'for'
stone.cpp:24:10: error: 'i' does not name a type
stone.cpp:24:17: error: 'i' does not name a type
stone.cpp:29:2: error: 'n' does not name a type
stone.cpp:30:2: error: expected unqualified-id before 'for'
stone.cpp:30:10: error: 'i' does not name a type
stone.cpp:30:15: error: 'i' does not name a type
stone.cpp:31:12: error: 'n' was not declared in this scope
stone.cpp:32:2: error: 'f' does not name a type
stone.cpp:33:2: error: expected unqualified-id before 'for'
stone.cpp:33:10: error: 'i' does not name a type
stone.cpp:33:15: error: 'i' does not name a type
stone.cpp:41:2: error: expected unqualified-id before 'for'
stone.cpp:41:10: error: 'i' does not name a type
stone.cpp:41:15: error: 'i' does not name a type
stone.cpp:45:2: error: expected unqualified-id before 'if'
stone.cpp:46:2: error: expected unqualified-id before 'else'
stone.cpp:47:2: error: expected unqualified-id before 'return'
stone.cpp:48:1: error: expected declaration before '}' token