Submission #1165880

#TimeUsernameProblemLanguageResultExecution timeMemory
1165880inesPyramids (IOI24_pyramids)C++20
Compilation error
0 ms0 KiB
#include "pyramids.h"
#include<numeric>
#include<vector>


void init(std::vector<int> A, std::vector<int> B) {
   static std::vector<int> staticA= A;
   static std::vector<int> staticB= B;
}
  // Initialization code
}

bool can_transform(int L, int R, int X, int Y) {
     static std::vector<int> staticA;
     static std::vector<int> staticB;
     int sum=std::accumulate(A.begin()+L,A.begin()+R,0);
    int sum2=std::accumulate(B.begin()+X,B.begin()+y,0);
    if(sum!=sum2){
      return false;
    }
    else if(sum1==sum2){
      int d=0;
      for(int i=0;i<n; i++){
        for(int j=i;j<n; j++){
          if(A[i]!=B[i]){
            d=d+1;
          }
  }
        }
      }
      if(d>1){
        return false;
      }
      else{
        return true;

      }
}

Compilation message (stderr)

pyramids.cpp:11:1: error: expected declaration before '}' token
   11 | }
      | ^
pyramids.cpp: In function 'bool can_transform(int, int, int, int)':
pyramids.cpp:16:30: error: 'A' was not declared in this scope
   16 |      int sum=std::accumulate(A.begin()+L,A.begin()+R,0);
      |                              ^
pyramids.cpp:17:30: error: 'B' was not declared in this scope
   17 |     int sum2=std::accumulate(B.begin()+X,B.begin()+y,0);
      |                              ^
pyramids.cpp:17:52: error: 'y' was not declared in this scope
   17 |     int sum2=std::accumulate(B.begin()+X,B.begin()+y,0);
      |                                                    ^
pyramids.cpp:21:13: error: 'sum1' was not declared in this scope; did you mean 'sum2'?
   21 |     else if(sum1==sum2){
      |             ^~~~
      |             sum2
pyramids.cpp:23:21: error: 'n' was not declared in this scope
   23 |       for(int i=0;i<n; i++){
      |                     ^
pyramids.cpp:31:10: error: 'd' was not declared in this scope
   31 |       if(d>1){
      |          ^
pyramids.cpp:38:1: warning: control reaches end of non-void function [-Wreturn-type]
   38 | }
      | ^