Submission #66118

# Submission time Handle Problem Language Result Execution time Memory
66118 2018-08-09T15:31:17 Z bortoz Xylophone (JOI18_xylophone) C++17
Compilation error
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second

int query(int,int);
void answer(int,int);

void solve(int N)
{
  vector<int> V{0,query(1,2)};
  for(int i=2; i<N; i++)
  {
    int a = query(i,i+1);
    int b = query(i-1,i+1);
    V.push_back(V.back() + (abs(a-b) == abs(V[i-1]-V[i-2])) == (V[i-2] < V[i-1])) ? a : -a);
  }
  auto it = minmax_element(V.begin(),V.end());
  bool flip = it.fi < it.se;
  int mi = *it.fi;
  for(int& i : V) i = flip ? i+1-mi : N-i+mi;
  for(int i=1; i<=N; i++)
    answer(i,V[i-1]);
}

Compilation message

xylophone.cpp: In function 'void solve(int)':
xylophone.cpp:16:16: error: could not convert 'V.std::vector<int>::push_back(((V.std::vector<int>::back() + (abs((a - b)) == abs((V.std::vector<int>::operator[](((std::vector<int>::size_type)(i - 1))) - V.std::vector<int>::operator[](((std::vector<int>::size_type)(i - 2))))))) == (V.std::vector<int>::operator[](((std::vector<int>::size_type)(i - 2))) < V.std::vector<int>::operator[](((std::vector<int>::size_type)(i - 1))))))' from 'void' to 'bool'
     V.push_back(V.back() + (abs(a-b) == abs(V[i-1]-V[i-2])) == (V[i-2] < V[i-1])) ? a : -a);
     ~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~