제출 #1337787

#제출 시각아이디문제언어결과실행 시간메모리
1337787vache_kocharyanJakarta Skyscrapers (APIO15_skyscraper)C++20
컴파일 에러
0 ms0 KiB
#define _CRT_SECURE_NO_WARNINGS
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt")
#include <iostream>
#include <cmath>
#include <algorithm>
#include <bitset>
#include <set>
#include <map>
#include <vector>
#include <string>
#include <queue>
using namespace std;

const int N = 3e4 + 5;
int c[N], p[N];
bool vis_sky[N];
set<int> vec[N];
bool vis_state[N][N];

void solve()
{
	int n, m;
	cin >> n >> m;

	for (int i = 0; i < m; i++)
	{
		cin >> c[i] >> p[i];
		vec[c[i]].insert(p[i]);
	}

	priority_queue<tuple<long long, int, int>, vector<tuple<long long, int, int>>, greater<tuple<long long, int, int>>> pq;

	pq.push({ 0, c[0], p[0] });
	vis_state[c[0]][p[0]] = true;

	while (!pq.empty())
	{
		auto [dist, pos, power] = pq.top();
		pq.pop();

		if (pos == c[1])
		{
			cout << dist;
			return;
		}

		if (!vis_sky[pos]) {
			vis_sky[pos] = true;
			for (int new_p : vec[pos]) {
				if (!vis_state[pos][new_p]) {
					vis_state[pos][new_p];
					pq.push({ dist, pos, new_p });
				}
			}
		}

		for (int d : { -1, 1 })
		{
			int nx = pos + d * power;
			if (nx >= 0 && nx < n) {
				if (!vis_state[nx][power]) {
					vis_state[nx][power] = true;
					pq.push({ dist + 1, nx, power });
				}
			}
		}
	}
	cout << -1;
}

int main()
{
	ios::sync_with_stdio(false);
	cin.tie(0);
	solve();
	return 0;
}

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

In file included from /usr/include/c++/13/string:43,
                 from /usr/include/c++/13/bits/locale_classes.h:40,
                 from /usr/include/c++/13/bits/ios_base.h:41,
                 from /usr/include/c++/13/ios:44,
                 from /usr/include/c++/13/ostream:40,
                 from /usr/include/c++/13/iostream:41,
                 from skyscraper.cpp:4:
/usr/include/c++/13/bits/allocator.h: In destructor 'constexpr std::_Rb_tree<int, int, std::_Identity<int>, std::less<int>, std::allocator<int> >::_Rb_tree_impl<std::less<int>, true>::~_Rb_tree_impl()':
/usr/include/c++/13/bits/allocator.h:184:7: error: inlining failed in call to 'always_inline' 'constexpr std::allocator< <template-parameter-1-1> >::~allocator() noexcept [with _Tp = std::_Rb_tree_node<int>]': target specific option mismatch
  184 |       ~allocator() _GLIBCXX_NOTHROW { }
      |       ^
In file included from /usr/include/c++/13/set:62,
                 from skyscraper.cpp:8:
/usr/include/c++/13/bits/stl_tree.h:662:16: note: called from here
  662 |         struct _Rb_tree_impl
      |                ^~~~~~~~~~~~~