Submission #777016

#TimeUsernameProblemLanguageResultExecution timeMemory
777016CookieArt Collections (BOI22_art)C++17
100 / 100
1295 ms648 KiB
#include<bits/stdc++.h>
#include<fstream>
#include "art.h"
using namespace std;
ifstream fin("HAMMING.INP");
ofstream fout("HAMMING.OUT");
#define sz(a) (int)a.size()
#define ll long long
#define pb push_back
#define forr(i, a, b) for(int i = a; i < b; i++)
#define dorr(i, a, b) for(int i = a; i >= b; i--)
#define ld long double
#define vt vector
#include<fstream>
#define fi first
#define se second
#define pll pair<ll, ll>
#define pii pair<int, int>
const ld PI = 3.14159265359;
using u128 = __uint128_t;
const int x[4] = {1, -1, 0, 0};
const int y[4] = {0, 0, 1, -1};
const ll mod = 1e18 + 7, inf = 1e9 + 5;
const int mxn = 2e5 + 5, sq = 400;

void solve(int n){
    vt<int>curr;
    for(int i = 1; i <= n; i++){
        curr.pb(i);
    }
    ll last = publish(curr);
    vt<bool>seen(n);
    vt<int>res(n);
    for(int i = 1; i < n; i++){
        curr.clear();
        for(int j = i + 1; j <= n; j++)curr.pb(j);
        for(int j = 1; j <= i; j++)curr.pb(j);
        ll nw = publish(curr);
        
        ll pos = (n - 1 + last - nw) / 2;
        
        res[pos] = i; seen[pos] = 1;
        last = nw;
    }
    for(int i = 0; i < n; i++){
        if(!seen[i]){
            res[i] = n;
        }
    }
    answer(res);
}

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