제출 #1331282

#제출 시각아이디문제언어결과실행 시간메모리
1331282Mamikonm1코끼리 (Dancing Elephants) (IOI11_elephants)C++17
컴파일 에러
0 ms0 KiB
#pragma GCC optimize("Ofast")
#pragma GCC target("avx2","avx")
#include "elephants.h"
#include<bits/stdc++.h>
using namespace std;
int n,l;
vector<int>x,Y;
void init(int N, int L, int X[])
{
    n = N;
    l=L;
    for(int i=0;i<n;++i)Y.push_back(X[i]);
    x=Y;
    sort(begin(x),end(x));
}

int update(int i, int y)
{
    int id;
    for(int j=0;j<n;++j)if(x[j]==Y[i]){
        id=j;
        break;
    }
    if(Y[i]>y){
        int j=id-1;
        while(j>=0 and x[j]>y){
            x[j+1]=x[j];
            --j;
        }
        x[j+1]=y;
    }
    else if(Y[i]!=y){
        int j=id+1;
        while(j<n and x[j]<y){
            x[j-1]=x[j];
            ++j;
        }
        x[j-1]=y;
    }
    Y[i]=y;
    int ans=0,lf=-(l*2);
    for(int i=0;i<n;++i){
        if(x[i]-lf>l){
            lf=x[i];
            ans++;
        }
    }
    return ans;
}

컴파일 시 표준 에러 (stderr) 메시지

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bitset:52,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:52,
                 from elephants.cpp:4:
/usr/include/c++/13/bits/allocator.h: In destructor 'std::_Vector_base<int, std::allocator<int> >::_Vector_impl::~_Vector_impl()':
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to 'always_inline' 'std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = int]': target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/vector:66,
                 from /usr/include/c++/13/functional:64,
                 from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:53:
/usr/include/c++/13/bits/stl_vector.h:133:14: note: called from here
  133 |       struct _Vector_impl
      |              ^~~~~~~~~~~~