Submission #879587

#TimeUsernameProblemLanguageResultExecution timeMemory
879587vladburacArt Collections (BOI22_art)C++17
100 / 100
1221 ms1596 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; const int NMAX = 4000; int cyc[NMAX+1]; int poz[NMAX+1]; void solve( int n ) { int i, nxt; vector <int> elem; for( i = 1; i <= n; i++ ) elem.push_back( i ); i = 1; do { cyc[i] = publish( elem ); elem.erase( elem.begin() ); elem.push_back( i ); i++; } while( i <= n ); for( i = 1; i <= n; i++ ) { if( i == n ) nxt = 1; else nxt = i + 1; poz[i] = ( cyc[i] - cyc[nxt] + n - 1 ) / 2 + 1; } vector <int> ans( n, 0 ); for( i = 1; i <= n; i++ ) ans[poz[i]-1] = i; answer( ans ); }

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...