/ Vijos /

记录详情

Compile Error

/in/foo.cc:40:11: error: expected initializer before 'ans'
   40 | int n,ans ans, S, L=0, K1=0, K2=0, arr[maxN], f[maxM] = { 0 }, T[maxN]={ 0 }, tot[maxM << 1] = { 0 };
      |           ^~~
/in/foo.cc:40:62: error: expected unqualified-id before ',' token
   40 | int n,ans ans, S, L=0, K1=0, K2=0, arr[maxN], f[maxM] = { 0 }, T[maxN]={ 0 }, tot[maxM << 1] = { 0 };
      |                                                              ^
/in/foo.cc:40:71: error: expected constructor, destructor, or type conversion before '=' token
   40 | int n,ans ans, S, L=0, K1=0, K2=0, arr[maxN], f[maxM] = { 0 }, T[maxN]={ 0 }, tot[maxM << 1] = { 0 };
      |                                                                       ^
/in/foo.cc:40:77: error: expected unqualified-id before ',' token
   40 | int n,ans ans, S, L=0, K1=0, K2=0, arr[maxN], f[maxM] = { 0 }, T[maxN]={ 0 }, tot[maxM << 1] = { 0 };
      |                                                                             ^
/in/foo.cc:40:94: error: expected constructor, destructor, or type conversion before '=' token
   40 | int n,ans ans, S, L=0, K1=0, K2=0, arr[maxN], f[maxM] = { 0 }, T[maxN]={ 0 }, tot[maxM << 1] = { 0 };
      |                                                                                              ^
/in/foo.cc: In function 'int main()':
/in/foo.cc:48:21: error: 'arr' was not declared in this scope
   48 |         scanf("%d",&arr[i]);
      |                     ^~~
/in/foo.cc:50:9: error: 'L' was not declared in this scope
   50 |         L += arr[i];
      |         ^
/in/foo.cc:53:5: error: 'N' was not declared in this scope
   53 |     N = n<<1;
      |     ^
/in/foo.cc:55:22: error: 'L' was not declared in this scope
   55 |        for ( int j = L; j > arr[i]; j--)
      |                      ^
/in/foo.cc:55:29: error: 'arr' was not declared in this scope
   55 |        for ( int j = L; j > arr[i]; j--)
      |                             ^~~
/in/foo.cc:56:12: error: 'f' was not declared in this scope
   56 |            f[j] = max(f[j], f[j-arr[i]]);
      |            ^
/in/foo.cc:58:8: error: 'f' was not declared in this scope
   58 |        f[arr[i]] = max(f[arr[i]], i);
      |        ^
/in/foo.cc:58:10: error: 'arr' was not declared in this scope
   58 |        f[arr[i]] = max(f[arr[i]], i);
      |          ^~~
/in/foo.cc:61:34: error: 'L' was not declared in this scope
   61 |            for ( int j = 1; j <= L; j++)
      |                                  ^
/in/foo.cc:62:34: error: 'T' was not declared in this scope
   62 |                if (f[j] > i-n+1) T[i-n+1]++;
      |                                  ^
/in/foo.cc:66:19: error: 'T' was not declared in this scope
   66 |        if ( tmp < T[i] ) tmp = T[i], ans = i;
      |                   ^
/in/foo.cc:66:38: error: 'ans' was not declared in this scope; did you mean 'abs'?
   66 |        if ( tmp < T[i] ) tmp = T[i], ans = i;
      |                                      ^~~
      |                                      abs
/in/foo.cc:68:17: error: 'ans' was not declared in this scope; did you mean 'abs'?
   68 |    printf("%d", ans);
      |                 ^~~
      |                 abs
/in/foo.cc:71:4: error: 'tot' was not declared in this scope
   71 |    tot[L]=1;
      |    ^~~
/in/foo.cc:71:8: error: 'L' was not declared in this scope
   71 |    tot[L]=1;
      |        ^
/in/foo.cc:74:11: error: 'K1' was not declared in this scope; did you mean 'y1'?
   74 |           K1 += arr[i];
      |           ^~
      |           y1
/in/foo.cc:74:17: error: 'arr' was not declared in this scope
   74 |           K1 += arr[i];
      |                 ^~~
/in/foo.cc:81:11: error: 'K2' was not declared in this scope
   81 |           K2 += arr[i];
      |           ^~
/in/foo.cc:81:17: error: 'arr' was not declared in this scope
   81 |           K2 += arr[i];
      |                 ^~~
/in/foo.cc:82:38: error: 'K1' was not declared in this scope; did you mean 'y1'?
   82 |           for ( int j = L - K2; j >= K1 - arr[i]; j++)
      |                                      ^~
      |                                      y1
/in/foo.cc:87:25: error: 'K1' was not declared in this scope; did you mean 'y1'?
   87 |   for ( int i = 1; i <= K1; i++)
      |                         ^~
      |                         y1
/in/foo.cc:89:11: error: 'S' was not declared in this scope
   89 |           S=i;
      |           ^
/in/foo.cc:93:16: error: 'S' was not declared in this scope
   93 |   printf("%d", S);
      |                ^

信息

递交者
类型
递交
题目
P1747 不给糖就捣乱
语言
C++
递交时间
2025-03-08 17:39:49
评测时间
2025-03-08 17:39:49
评测机
分数
0
总耗时
0ms
峰值内存
0 Bytes