Submission #733668

#TimeUsernameProblemLanguageResultExecution timeMemory
733668tudorArt Collections (BOI22_art)C++17
100 / 100
1437 ms840 KiB
#include "art.h" #include <iostream> #include <vector> using namespace std; vector < int > perm, a; void solve ( int n ) { a.resize ( n ); perm.resize ( n ); for ( int i = 1; i <= n; i++ ) perm[i - 1] = i; int last = publish ( perm ); if ( last == 0 ) answer ( perm ); else { int s = n * ( n + 1 ) / 2; for ( int i = 1; i < n; i++ ) { int x = perm[n - 1]; for ( int j = n - 1; j > 0; j-- ) perm[j] = perm[j - 1]; perm[0] = x; int next = publish ( perm ); int inv = ( n + next - last - 1 ) / 2; a[inv] = x; s -= x; last = next; } for ( int i = 0; i < n; i++ ) if ( a[i] == 0 ) a[i] = s; answer ( a ); } }

Compilation message (stderr)

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) {
      |        ~~~~~~~~~^~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...