답안 #66116

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
66116 2018-08-09T15:29:17 Z bortoz Xylophone (JOI18_xylophone) C++17
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
using namespace std;

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

void solve(int N)
{
  vector<int> V(N);
  V[1] = query(1,2);
  for(int i=2; i<N; i++)
  {
    int a = query(i,i+1);
    int b = query(i-1,i+1);
    if((abs(a-b) == abs(V[i-1]-V[i-2])) == (V[i-2] < V[i-1]))
      V[i] = V[i-1] + a;
    else
      V[i] = V[i-1] - 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:21:18: error: 'struct std::pair<__gnu_cxx::__normal_iterator<int*, std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int> > >' has no member named 'fi'
   bool flip = it.fi < it.se;
                  ^~
xylophone.cpp:21:26: error: 'struct std::pair<__gnu_cxx::__normal_iterator<int*, std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int> > >' has no member named 'se'
   bool flip = it.fi < it.se;
                          ^~
xylophone.cpp:22:16: error: 'struct std::pair<__gnu_cxx::__normal_iterator<int*, std::vector<int> >, __gnu_cxx::__normal_iterator<int*, std::vector<int> > >' has no member named 'fi'
   int mi = *it.fi;
                ^~