Submission #873149

#TimeUsernameProblemLanguageResultExecution timeMemory
873149Faisal_SaqibArt Collections (BOI22_art)C++17
70 / 100
1113 ms1692 KiB
#include "art.h" #include <iostream> #include <algorithm> #include <climits> #include <queue> #include <cmath> #include <map> #include <set> #include <random> #include <chrono> #include <iomanip> #include <vector> #include <fstream> using namespace std; #define vll vector<ll> #define sll set<ll> #define vstr vector<string> #define ll long long #define ld long double #define supra main #define pb push_back #define add insert #define rall(x) rbegin(x),rend(x) #define all(x) (x).begin(),(x).end() #define I ios_base::sync_with_stdio(false); #define Hear cin.tie(NULL); #define Shots cout.tie(NULL); #define Ratatatata #define bits_on(a) (__builtin_popcountll(a)) #define mx_pw2(a) (__builtin_ctzll(a)) mt19937 RNG(chrono::steady_clock::now().time_since_epoch().count()); #define SHUFFLE(v) shuffle(all(v), RNG); void solve(int n) { vector<int> order(n); vector<int> help; for(int i=1;i<=n;i++) help.pb(i); SHUFFLE(help) for(auto i:help) { vector<int> NEW(n); int p=0; int l=1; for(;p<(n-1);l++) if(l!=i) NEW[p++]=l; NEW[p]=i; int x=publish(NEW); if(x==0) { answer(NEW); return; } for(int i=n-1;i>0;i--) swap(NEW[i],NEW[i-1]); int y=publish(NEW); if(y==0) { answer(NEW); return; } int ip=(x-n-y-1)/(-2); order[ip-1]=i; } answer(order); return; }

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