제출 #1311481

#제출 시각아이디문제언어결과실행 시간메모리
1311481tamzidPyramids (IOI24_pyramids)C++20
컴파일 에러
0 ms0 KiB
#include "pyramids.h" using namespace std; vector<ll> a, b; void init(std::vector<int> A, std::vector<int> B) { // Initialization code int n = A.size(); a.resize(n); b.resize(n); for(int i=0;i<n;++i) { a[i] = A[i]; b[i] = B[i]; } for(int i=1;i<n;++i) { a[i] += a[i - 1]; b[i] += b[i - 1]; } } bool can_transform(int L, int R, int X, int Y) { ll s1 = a[R - 1] - (l > 0 ? a[L - 1] : 0); ll s2 = b[R - 1] - (l > 0 ? b[L - 1] : 0); return s1 == s2; }

컴파일 시 표준 에러 (stderr) 메시지

pyramids.cpp:4:8: error: 'll' was not declared in this scope
    4 | vector<ll> a, b;
      |        ^~
pyramids.cpp:4:10: error: template argument 1 is invalid
    4 | vector<ll> a, b;
      |          ^
pyramids.cpp:4:10: error: template argument 2 is invalid
pyramids.cpp: In function 'void init(std::vector<int>, std::vector<int>)':
pyramids.cpp:9:5: error: request for member 'resize' in 'a', which is of non-class type 'int'
    9 |   a.resize(n);
      |     ^~~~~~
pyramids.cpp:10:5: error: request for member 'resize' in 'b', which is of non-class type 'int'
   10 |   b.resize(n);
      |     ^~~~~~
pyramids.cpp:12:6: error: invalid types 'int[int]' for array subscript
   12 |     a[i] = A[i];
      |      ^
pyramids.cpp:13:6: error: invalid types 'int[int]' for array subscript
   13 |     b[i] = B[i];
      |      ^
pyramids.cpp:16:6: error: invalid types 'int[int]' for array subscript
   16 |     a[i] += a[i - 1];
      |      ^
pyramids.cpp:16:14: error: invalid types 'int[int]' for array subscript
   16 |     a[i] += a[i - 1];
      |              ^
pyramids.cpp:17:6: error: invalid types 'int[int]' for array subscript
   17 |     b[i] += b[i - 1];
      |      ^
pyramids.cpp:17:14: error: invalid types 'int[int]' for array subscript
   17 |     b[i] += b[i - 1];
      |              ^
pyramids.cpp: In function 'bool can_transform(int, int, int, int)':
pyramids.cpp:22:3: error: 'll' was not declared in this scope
   22 |   ll s1 = a[R - 1] - (l > 0 ? a[L - 1] : 0);
      |   ^~
pyramids.cpp:23:5: error: expected ';' before 's2'
   23 |   ll s2 = b[R - 1] - (l > 0 ? b[L - 1] : 0);
      |     ^~~
      |     ;
pyramids.cpp:24:10: error: 's1' was not declared in this scope
   24 |   return s1 == s2;
      |          ^~
pyramids.cpp:24:16: error: 's2' was not declared in this scope
   24 |   return s1 == s2;
      |                ^~