Submission #328355

# Submission time Handle Problem Language Result Execution time Memory
328355 2020-11-16T09:22:44 Z Sho10 Xoractive (IZhO19_xoractive) C++14
Compilation error
0 ms 0 KB
#include <bits/stdc++.h> //Andrei Alexandru a.k.a Sho10
#include "interactive.h"
#define ll long long
#define double long double
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#define all(a) (a).begin(), (a).end()
#define f first
#define s second
#define pb push_back
#define mp make_pair
#define pi pair
#define rc(s) return cout<<s,0
#define endl '\n'
#define mod (10*10*10*10*10*10*10*10*10+7)
#define PI 3.14159265359
#define MAXN 100005
#define INF 1000000005
#define LINF 1000000000000000005ll
#define CODE_START  ios_base::sync_with_stdio(false);cin.tie(0);cout.tie(0);
using namespace std;
vector<int> guess(int n){
vector<int>ans;
for(int i=1;i<=n;i++)
{
    ans.pb(ask[i]);
}
if(ans.size()>=2){
swap(ans[0],ans[1]);
}
return ans;
}
/*
int32_t main(){
CODE_START;
*/

Compilation message

Xoractive.cpp: In function 'std::vector<int> guess(int)':
Xoractive.cpp:26:17: warning: pointer to a function used in arithmetic [-Wpointer-arith]
   26 |     ans.pb(ask[i]);
      |                 ^
Xoractive.cpp:26:18: error: no matching function for call to 'push_back(int (&)(int))'
   26 |     ans.pb(ask[i]);
      |                  ^
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from Xoractive.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:1184:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(const value_type&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]' <near match>
 1184 |       push_back(const value_type& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1184:7: note:   conversion of argument 1 would be ill-formed:
Xoractive.cpp:26:17: error: invalid conversion from 'int (*)(int)' to 'std::vector<int>::value_type' {aka 'int'} [-fpermissive]
   26 |     ans.pb(ask[i]);
      |            ~~~~~^
      |                 |
      |                 int (*)(int)
In file included from /usr/include/c++/9/vector:67,
                 from /usr/include/c++/9/queue:61,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from Xoractive.cpp:1:
/usr/include/c++/9/bits/stl_vector.h:1200:7: note: candidate: 'void std::vector<_Tp, _Alloc>::push_back(std::vector<_Tp, _Alloc>::value_type&&) [with _Tp = int; _Alloc = std::allocator<int>; std::vector<_Tp, _Alloc>::value_type = int]' <near match>
 1200 |       push_back(value_type&& __x)
      |       ^~~~~~~~~
/usr/include/c++/9/bits/stl_vector.h:1200:7: note:   conversion of argument 1 would be ill-formed:
Xoractive.cpp:26:17: error: invalid conversion from 'int (*)(int)' to 'std::vector<int>::value_type' {aka 'int'} [-fpermissive]
   26 |     ans.pb(ask[i]);
      |            ~~~~~^
      |                 |
      |                 int (*)(int)