QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#236670#6311. 火车站Senex_Nostalgia#Compile Error//C++171.8kb2023-11-04 09:45:122024-07-04 02:22:51

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 02:22:51]
  • 评测
  • [2023-11-04 09:45:12]
  • 提交

answer

/*
 * Copyright© 2023 Nostalgia. All rights reserved.
 * author: Nostalgia
 * Problem: QOJ#6331 火车站
 * Tag: 并查集
 * Memory Limit: 512MiB
 * Time Limit: 1000ms
 * Source: 联合省选2023
 * Date: 2023-11-04 
 */

// Viva los artistas y su amor
// 我将同烟火一般灿烂
// Viva los artistas y su amor
// 我将同河流一般深远
#pragma GCC optimize("O3,unroll-loops")
#pragma GCC target("avx2,sse2,bmi,bmi2,lzcnt,popcnt")
#include <bits/stdc++.h>
using i64 = long long;

constexpr int N = 2e5 + 10;

int fa[N];
int find(int x) {return x == fa[x] ? fa[x] : fa[x] = find(fa[x]);}

std::pair<int, int> seg[N];
int n, m, x;

int main() {
	std::ios::sync_with_stdio(false);
	std::cin.tie(nullptr);

	std::cin >> n >> m >> x;
	for (int i = 1; i <= m; i++) {
		std::cin >> seg[i].first >> seg[i].second;
		fa[i] = i;
	}	
	int curl = 0, curr = 0;
	std::sort(seg + 1, seg + 1 + m);
	for (int i = 1; i <= m; i++) {
		if (seg[i].first > curr) {
			curl = seg[i].first, curr = seg[i].second;
		} else {
			curr = std::max(curr, seg[i].second);
			fa[i] = find(i - 1);
		}
	}
	int pos = 0;
	for (int i = 1; i <= m; i++) {
		if (seg[i].first <= x && x <= seg[i].second)
			pos = i;
	}
	if (!pos) {
		std::cout << "0" << '\n';
		return 0;
	}

	std::vector<int> vec;
	for (int i = 1; i <= m; i++) {
		if (find(i) == find(pos)) {
			if (seg[i].first >= x)
				vec.push_back(seg[i].second);
			else if (seg[i].second < x)
				vec.push_back(seg[i].first);
			else
				vec.push_back(seg[i].first), vec.push_back(seg[i].second);
		}
	}
	std::sort(vec.begin(), vec.end());
	vec.erase(std::unique(vec.begin(), vec.end()), vec.end());
	for (const int &p : vec)
		if (p != x)
			std::cout << p << ' ';
	std::cout << '\n';
	return 0;
}

Details

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 answer.code:18:
/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
      |              ^~~~~~~~~~~~