Submission #651885

#TimeUsernameProblemLanguageResultExecution timeMemory
651885Specialistas13Art Collections (BOI22_art)C++17
100 / 100
1623 ms728 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int N) { vector<int> order; int poz[5000]; bool taken[5000]; int x, y, o, z, bad=0; for (int i=1; i<=N; i++){ order.push_back(i); poz[i]=0; taken[i]=false; } x=publish(order); for (int i=1; i<=N-1; i++){ order.clear(); for (int j=i+1; j<=N; j++){ order.push_back(j); } for (int j=1; j<=i; j++){ order.push_back(j); } y=publish(order); o=(y-x-N)/(-2); //z=N-o; poz[o+1]=i; taken[o+1]=true; x=y; } for (int i=1; i<=N; i++){ if (!taken[i]){ poz[i]=N; break; } } order.clear(); for (int i=1; i<=N; i++){ order.push_back(poz[i]); } answer(order); }

Compilation message (stderr)

art.cpp: In function 'void solve(int)':
art.cpp:9:18: warning: unused variable 'z' [-Wunused-variable]
    9 |     int x, y, o, z, bad=0;
      |                  ^
art.cpp:9:21: warning: unused variable 'bad' [-Wunused-variable]
    9 |     int x, y, o, z, bad=0;
      |                     ^~~
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...