Submission #653524

#TimeUsernameProblemLanguageResultExecution timeMemory
653524prvocisloArt Collections (BOI22_art)C++17
100 / 100
1501 ms720 KiB
#include "art.h" #include <algorithm> #include <bitset> #include <cassert> #include <chrono> #include <cmath> #include <deque> #include <iomanip> #include <iostream> #include <map> #include <queue> #include <random> #include <set> #include <string> #include <vector> typedef long long ll; typedef long double ld; using namespace std; // publish(order), answer(order) void solve(int n) { vector<int> v(n); for (int i = 0; i < n; i++) v[i] = i + 1; int a = publish(v); for (int i = n - 2; i >= 0; i--) { // ideme umiestnit v[i] tam dozadu kde ma byt int siz = n - 1 - i; vector<int> v2 = v; v2.erase(v2.begin() + i); v2.push_back(v[i]); int b = publish(v2); int sub = (a + b - siz) / 2; a -= sub; b -= sub; v.insert(v.begin() + i + a + 1, v[i]); v.erase(v.begin() + i); a = sub; } answer(v); }

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