Submission #896333

# Submission time Handle Problem Language Result Execution time Memory
896333 2024-01-01T09:36:52 Z LCJLY Art Collections (BOI22_art) C++17
Compilation error
0 ms 0 KB
#include "art.h"
#include <bits/stdc++.h>
using namesapce std;


//solve function
void solve(int n) {
    //std::vector<int> order = {1, 2, 3};
    //publish(order);
    //order = {2, 3, 1};
    //publish(order);
    //order = {1, 3, 2};
    //answer(order);

	deque<int>d;
	vector<int>storage;
	for(int x=1;x<=n;x++){
		d.push_back(x);
		storage.push_back(x);
	}
		
	int ans[n+5];
	memset(ans,-1,sizeof(ans));
	int last=publish(storage);
	
	for(int x=1;x<n;x++){
		vector<int>cur;
		d.push_front(d.back());
		d.pop_back();
		for(auto it:d){
			cur.push_back(it);
		}
		
		int hold=publish(cur);
		//show2(last,last,hold,hold);
		int index=1+(n-1-(last-hold))/2;
		//show(index,index);
		ans[index]=d.front();
		
		last=hold;
	}
	
	vector<int>amos;
	for(int x=1;x<=n;x++){
		if(ans[x]==-1){
			amos.push_back(d.back());
		}
		else{
			amos.push_back(ans[x]);
		}
	}
	
	answer(amos);
}

Compilation message

art.cpp:3:7: error: expected nested-name-specifier before 'namesapce'
    3 | using namesapce std;
      |       ^~~~~~~~~
art.cpp: In function 'void solve(int)':
art.cpp:15:2: error: 'deque' was not declared in this scope
   15 |  deque<int>d;
      |  ^~~~~
art.cpp:15:2: note: suggested alternatives:
In file included from /usr/include/c++/10/deque:67,
                 from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:68,
                 from art.cpp:2:
/usr/include/c++/10/bits/stl_deque.h:764:11: note:   'std::deque'
  764 |     class deque : protected _Deque_base<_Tp, _Alloc>
      |           ^~~~~
In file included from /usr/include/x86_64-linux-gnu/c++/10/bits/stdc++.h:68,
                 from art.cpp:2:
/usr/include/c++/10/deque:83:13: note:   'std::pmr::deque'
   83 |       using deque = std::deque<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~
art.cpp:15:8: error: expected primary-expression before 'int'
   15 |  deque<int>d;
      |        ^~~
art.cpp:16:2: error: 'vector' was not declared in this scope
   16 |  vector<int>storage;
      |  ^~~~~~
art.cpp:16:2: note: suggested alternatives:
In file included from /usr/include/c++/10/vector:67,
                 from art.h:1,
                 from art.cpp:1:
/usr/include/c++/10/bits/stl_vector.h:389:11: note:   'std::vector'
  389 |     class vector : protected _Vector_base<_Tp, _Alloc>
      |           ^~~~~~
In file included from art.h:1,
                 from art.cpp:1:
/usr/include/c++/10/vector:86:13: note:   'std::pmr::vector'
   86 |       using vector = std::vector<_Tp, polymorphic_allocator<_Tp>>;
      |             ^~~~~~
art.cpp:16:9: error: expected primary-expression before 'int'
   16 |  vector<int>storage;
      |         ^~~
art.cpp:18:3: error: 'd' was not declared in this scope
   18 |   d.push_back(x);
      |   ^
art.cpp:19:3: error: 'storage' was not declared in this scope
   19 |   storage.push_back(x);
      |   ^~~~~~~
art.cpp:24:19: error: 'storage' was not declared in this scope
   24 |  int last=publish(storage);
      |                   ^~~~~~~
art.cpp:27:10: error: expected primary-expression before 'int'
   27 |   vector<int>cur;
      |          ^~~
art.cpp:28:3: error: 'd' was not declared in this scope
   28 |   d.push_front(d.back());
      |   ^
art.cpp:31:4: error: 'cur' was not declared in this scope
   31 |    cur.push_back(it);
      |    ^~~
art.cpp:34:20: error: 'cur' was not declared in this scope
   34 |   int hold=publish(cur);
      |                    ^~~
art.cpp:43:9: error: expected primary-expression before 'int'
   43 |  vector<int>amos;
      |         ^~~
art.cpp:46:4: error: 'amos' was not declared in this scope; did you mean 'acos'?
   46 |    amos.push_back(d.back());
      |    ^~~~
      |    acos
art.cpp:46:19: error: 'd' was not declared in this scope
   46 |    amos.push_back(d.back());
      |                   ^
art.cpp:49:4: error: 'amos' was not declared in this scope; did you mean 'acos'?
   49 |    amos.push_back(ans[x]);
      |    ^~~~
      |    acos
art.cpp:53:9: error: 'amos' was not declared in this scope; did you mean 'acos'?
   53 |  answer(amos);
      |         ^~~~
      |         acos
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) {
      |        ~~~~~~~~~^~~~