Submission #709926

# Submission time Handle Problem Language Result Execution time Memory
709926 2023-03-14T20:05:49 Z Karpin Art Collections (BOI22_art) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
#include "art.h"

using namespace std;


#define ll long long
#define vt vector
#define ar array


void solve(unsigned long int N){
    
    vt<int> cur;
    vt<int> real;


    for (int i = 0; i < N; i++){
        real.push_back(0);
        cur.push_back(i + 1);
    }

    int first = publish(cur);


    for(int i = 0; i < N - 1; i++){
        
        rotate(cur.begin(), cur.begin() + 1, cur.end());
        int second = publish(cur);

        int bom = first - second;
        bom--;
        bom += N;
        bom /= 2;
        real[bom] = cur[N - 1];
        first = second;
    }

    for (int i = 0; i < N; i++){
        if (real[i] == 0) {
            real[i] = N;
            break;
        }
    }

    answer(real);

    


}

// int main(){

// 	ios::sync_with_stdio(0);
// 	cin.tie(0);
	
// 	int testcases = 1;

// 	// cin >> testcases;

// 	while(testcases--){
// 		solve();
// 	}

// 	return 0;

// }

Compilation message

art.cpp: In function 'void solve(long unsigned int)':
art.cpp:18:23: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
   18 |     for (int i = 0; i < N; i++){
      |                     ~~^~~
art.cpp:26:22: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
   26 |     for(int i = 0; i < N - 1; i++){
      |                    ~~^~~~~~~
art.cpp:39:23: warning: comparison of integer expressions of different signedness: 'int' and 'long unsigned int' [-Wsign-compare]
   39 |     for (int i = 0; i < N; i++){
      |                     ~~^~~
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) {
      |        ~~~~~~~~~^~~~
/usr/bin/ld: /tmp/ccSBcQBF.o: in function `main':
interface.cpp:(.text.startup+0x16): undefined reference to `solve(int)'
collect2: error: ld returned 1 exit status