Submission #924007

# Submission time Handle Problem Language Result Execution time Memory
924007 2024-02-08T08:43:37 Z berr Art Collections (BOI22_art) C++17
Compilation error
0 ms 0 KB
void solve(int n)
{
 
    vector<int> ans(n), val(n), pos(n);
     
    for(int i=0; i<n; i++){
        vector<int> b(n);

        for(int l=i; l<i+n; l++){
            b[l-i]=l%n; b[l-i]++;
        }

        val[i] = publish(b);
    }

    for(int i=0; i<n; i++){
        ans[(val[i]-val[(i+1)%n]+n-1)/2]=i+1;
    }

    answer(ans);
 
} 

Compilation message

art.cpp: In function 'void solve(int)':
art.cpp:4:5: error: 'vector' was not declared in this scope
    4 |     vector<int> ans(n), val(n), pos(n);
      |     ^~~~~~
art.cpp:4:12: error: expected primary-expression before 'int'
    4 |     vector<int> ans(n), val(n), pos(n);
      |            ^~~
art.cpp:7:16: error: expected primary-expression before 'int'
    7 |         vector<int> b(n);
      |                ^~~
art.cpp:10:13: error: 'b' was not declared in this scope
   10 |             b[l-i]=l%n; b[l-i]++;
      |             ^
art.cpp:13:9: error: 'val' was not declared in this scope
   13 |         val[i] = publish(b);
      |         ^~~
art.cpp:13:26: error: 'b' was not declared in this scope
   13 |         val[i] = publish(b);
      |                          ^
art.cpp:13:18: error: 'publish' was not declared in this scope
   13 |         val[i] = publish(b);
      |                  ^~~~~~~
art.cpp:17:9: error: 'ans' was not declared in this scope
   17 |         ans[(val[i]-val[(i+1)%n]+n-1)/2]=i+1;
      |         ^~~
art.cpp:17:14: error: 'val' was not declared in this scope
   17 |         ans[(val[i]-val[(i+1)%n]+n-1)/2]=i+1;
      |              ^~~
art.cpp:20:12: error: 'ans' was not declared in this scope
   20 |     answer(ans);
      |            ^~~
art.cpp:20:5: error: 'answer' was not declared in this scope
   20 |     answer(ans);
      |     ^~~~~~
interface.cpp: In function 'int publish(std::vector<int>)':
interface.cpp:20:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   20 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~
interface.cpp: In function 'void answer(std::vector<int>)':
interface.cpp:36:17: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   36 |     if(v.size() != N) {
      |        ~~~~~~~~~^~~~