Submission #644541

#TimeUsernameProblemLanguageResultExecution timeMemory
644541Tudy006Art Collections (BOI22_art)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> using namespace std; vector <int> p; vector <int> ans; //int publish( vector <int> p ) { // int x; // for ( auto it : p ) cout << it << ' '; // cout << endl; // cin >> x; // return x; // //} //void answer( vector <int> p ) { // cout << "The answer is: "; // for ( auto it : p ) cout << it << ' '; //} void solve( int n ) { for ( int i = 1; i <= n; i ++ ) p.push_back( i ); int x = publish( p ), a = x, b; for ( int i = 2; i <= n; i ++ ) { int aux = p[0]; for ( int i = 0; i + 1 < n; i ++ ) p[i] = p[i + 1]; p[n - 1] = aux; b = publish( p ); ans.push_back( ( n - 1 + a - b ) / 2 + 1 ); a = b; } ans.push_back( ( n - 1 + x - a ) / 2 + 1 ); answer( ans ); }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:22:13: error: 'publish' was not declared in this scope
   22 |     int x = publish( p ), a = x, b;
      |             ^~~~~~~
art.cpp:27:9: error: 'b' was not declared in this scope
   27 |         b = publish( p );
      |         ^
art.cpp:28:34: error: 'a' was not declared in this scope
   28 |         ans.push_back( ( n - 1 + a - b ) / 2 + 1 );
      |                                  ^
art.cpp:31:34: error: 'a' was not declared in this scope
   31 |     ans.push_back( ( n - 1 + x - a ) / 2 + 1 );
      |                                  ^
art.cpp:32:5: error: 'answer' was not declared in this scope
   32 |     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) {
      |        ~~~~~~~~~^~~~