Submission #644033

#TimeUsernameProblemLanguageResultExecution timeMemory
644033Vladth11Art Collections (BOI22_art)C++17
100 / 100
1656 ms688 KiB
#include <bits/stdc++.h> #include "art.h" #define debug(x) cerr << #x << " " << x << "\n" #define debugs(x) cerr << #x << " " << x << " " #pragma GCC optimize("Ofast") using namespace std; typedef long long ll; typedef pair <int, int> pii; const int bSize = 10; const int bits = 15; const int NMAX = 100000; const int VMAX = NMAX * 89; void solve(int N) { int n = N; vector<int> order; for(int i = 1; i <= N; i++) order.push_back(i); int initial = publish(order); for(int i = n - 1; i >= 1; i--){ vector <int> nou; int spate = n - i, unde = 0, cc = 0; for(auto x : order){ if(x != i){ nou.push_back(x); }else{ unde = cc; } cc++; } nou.push_back(i); int acum = publish(nou); acum -= initial; /// -a + A = acum /// a + A = spate /// -a = A - spate /// A - spate + A = acum /// 2A = acum + spate int mari = (acum + spate) / 2; int mici = spate - mari; unde += mici; for(int j = nou.size() - 1; j > unde; j--){ nou[j] = nou[j - 1]; } nou[unde] = i; acum += initial; acum -= mari; initial = acum; order = nou; } answer(order); }

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