Submission #962054

#TimeUsernameProblemLanguageResultExecution timeMemory
962054marinalucaArt Collections (BOI22_art)C++17
100 / 100
1171 ms1748 KiB
#include <bits/stdc++.h>
#include "art.h"
//#pragma GCC optimize ("O4")
//#pragma GCC optimize ("fast-math")
//#pragma GCC optimize ("unroll-loops")
 
using namespace std;
//using vii = vector <int>;
using maaa = map <int, int>;
//#define int long long
#define ll long long
#define XX first
#define YY second
#define all (x) begin(x), end(x)
//#define pb push_back
//#define mp make_pair
//#define pf push_front
//#define pp pop_front
//#define pub pop_back
/**#define cin fin
#define cout fout
ifstream cin ("pfn.in");
ofstream cout ("pfn.out");
**/
typedef double dbl;
typedef long double ldb;
typedef pair <int, int> pii;
typedef vector <int> vii;
typedef pair <double, int> pdi;
typedef float fl;

const int SMAX = 10;
const int VMAX = 1;
const int RMAX = 179;
const int NMAX = 4e3;

void solve (int N){
    int n = N;
    vector <int> ans(n), v;
    for (int i = 1; i <= n; ++ i){
        v.push_back(i);
    }
    int rasp = publish(v), pr;
    for (int i = 1; i < n; ++ i){
        int val = v[0];
        v.erase(v.begin());
        v.push_back(val);
        pr = publish(v);
        ans[(n - 1 - pr + rasp) / 2] = i;
        rasp = pr;
    }
    for (int i = 0; i < n; ++ i){
        if (ans[i] == 0)
            ans[i] = n;
    }
    answer (ans);
}
/**signed main(void){
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    solve();
    return 0 ^ 0;
}**/

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