Submission #603300

#TimeUsernameProblemLanguageResultExecution timeMemory
603300DanerZeinArt Collections (BOI22_art)C++17
20 / 100
111 ms300 KiB
#include "art.h" #include <bits/stdc++.h> using namespace std; void solve(int N) { vector<int> ord; for(int i=1;i<=N;i++) ord.push_back(i); for(int i=1;i<N;i++){ vector<int> aux=ord; int ra=publish(aux); int d=max(0,i-ra); aux.erase(aux.begin()+i); aux.insert(aux.begin()+d,(i+1)); int ant=1e9; for(int j=d;j<=i;j++){ int rp=publish(aux); if(rp>ant){ swap(aux[j],aux[j-1]); break; } if(j==i) break; ant=rp; swap(aux[j],aux[j+1]); } ord=aux; } answer(ord); }

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