Submission #635174

#TimeUsernameProblemLanguageResultExecution timeMemory
635174PanTkdArt Collections (BOI22_art)C++17
0 / 100
0 ms208 KiB
//
//  main.cpp
//
//  Created by Panagiotis Chadjicostas on
//  Copyright © Panagiotis Hadjicostas. All rights reserved.
//
#include "art.h"
#include <iostream>
#include <algorithm>
#include <bitset>
#include <complex>
#include <deque>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <limits>
#include <list>
#include <cstring>
#include <map>
#include <queue>
#include <set>
#include <stack>
#include <string>
#include <vector>
#include <unordered_map>

using namespace std;

typedef int ll;
typedef vector<ll> vi;
typedef pair<ll,ll> ii;
#define fo(i,a,b) for(int i = a; i<=b; i++)
#define f(i,b) for(int i=0;i<b;i++)
#define F first
#define S second
#define sz size
#define ls s,m,idx<<1
#define rs m+1,e,idx<<1|1
const ll MOD=ll(1e9)+7;
const ll MAXN=2*ll(1e6);
///////////////////////////////////////////////////////////////////////

//
// --- Sample implementation for the task art ---
//
// To compile this program with the sample grader, place:
//     art.h art_sample.cpp sample_grader.cpp
// in a single folder, then open the terminal in this directory (right-click onto an empty spot in the directory,
// left click on "Open in terminal") and enter e.g.:
//     g++ -std=c++17 art_sample.cpp sample_grader.cpp
// in this folder. This will create a file a.out in the current directory which you can execute from the terminal
// as ./a.out
// See task statement or sample_grader.cpp for the input specification
//
void solve(int N) {
    vi a;
    for(ll i=1;i<=N;i++)a.push_back(i);
    vi ans(N+1,ll());
    ll &n=N;
    for(ll i=1;i<=N;i++){
        vi temp;
        temp.push_back(i);
        for(ll j=1;j<=N;j++)if(j!=i)temp.push_back(j);
        ll ans1=publish(temp);

        temp.clear();
        
        for(ll j=1;j<=N;j++)if(j!=i)temp.push_back(j);
        temp.push_back(i);
        ll ans2=publish(temp);
        // erxomai sto telos, osous eimai meg (esto k) +k parapona, -(n-k)=-n+k
        // --'-- 
        //ans1=ans2-n+2k
        // k = (ans1-ans2 + n) /2
        ll idx=(ans1-ans2 + n) /2;
        ans[idx]=i;
    }
    vi ans2;
    for(ll i=1;i<=n;i++){
        ans2.push_back(ans[i]);
    }
    answer(ans2);
}

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