QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#866116 | #9726. AUS | ucup-team3646# | Compile Error | / | / | C++20 | 2.3kb | 2025-01-22 12:13:03 | 2025-01-22 12:13:03 |
Judging History
This is the latest submission verdict.
- [2025-01-22 12:13:03]
- Judged
- Verdict: Compile Error
- Time: 0ms
- Memory: 0kb
- [2025-01-22 12:13:03]
- Submitted
answer
#include <bits/stdc++.h>
using namespace std;
using ll = long long;
#define rep(i, n) for(ll i = 0; i < (n); ++i)
#define rep2(i, l, r) for(ll i = (l); i < (r); ++i)
using vi = vector<int>;
using vvi = vector<vi>;
using vll = vector<ll>;
#define all(A) A.begin(), A.end()
#define elif else if
using pii = pair<ll, ll>;
bool chmin(auto &a, auto b) {return a > b ? a = b, 1 : 0;}
bool chmax(auto &a, auto b) {return a < b ? a = b, 1 : 0;}
struct IOS {
IOS() {
cin.tie(0);
ios::sync_with_stdio(0);
}
} iosetup;
template<class T>
void print(vector<T> a) {
for(auto x : a) cout << x << ' ';
cout << endl;
}
void print(auto x) {
cout << x << endl;
}
template<class Head, class... Tail>
void print(Head &&head, Tail &&...tail) {
cout << head << ' ';
print(forward<Tail>(tail)...);
}
struct edge {
ll to, cost;
edge() = default;
edge(ll t, ll c) : to(t), cost(c) { }
};
void solve() {
ll N, F; cin >> N >> F;
vector<array<ll, 2>> LR(N);
rep(i, N) {
ll a, b; cin >> a >> b;
LR[i] = {a, b};
}
set<ll> zat;
for(auto [a, b] : LR) {
zat.insert(a);
zat.insert(b);
}
zat.insert(F);
vector<ll> h;
map<ll, ll> mp;
ll siz = 0;
for(auto x : zat) {
h.emplace_back(x);
mp[x] = siz++;
}
assert((ll)h.size() == siz);
vector graph(N, vector<edge>());
rep(i, siz-1) {
graph[i].push_back(edge(i+1, h[i+1] - h[i]));
graph[i+1].push_back(edge(i, 0));
}
for(auto [l, r] : LR) {
ll u = mp[l], v = mp[r];
graph[u].push_back(edge(v, 0));
}
const ll INF = 1e15;
vector<ll> dist(siz, INF);
{
priority_queue< array<ll, 2>, vector<array<ll, 2>>, greater<array<ll, 2>> > pq;
ll r = mp[F];
dist[r] = 0;
pq.emplace(dist[r], r);
while(pq.size()) {
auto [d, v] = pq.top();
pq.pop();
if(dist[v] < d) continue;
for(auto e : graph[v]) {
if(chmin(dist[e.to], dist[v] + e.cost)) {
pq.emplace(dist[e.to], e.to);
}
}
}
}
ll mx = 0, base = 0;
for(auto [l, r] : LR) {
chmax(mx, r);
base += (r - l);
}
ll diff = dist[mp[mx]];
ll res = base + diff;
cout << res << '\n';
return;
}
int main() {
hoge
ll T; cin >> T;
while(T--) {
solve();
}
return 0;
}
详细
answer.code: In function ‘int main()’: answer.code:115:1: error: ‘hoge’ was not declared in this scope 115 | hoge | ^~~~ answer.code:116:16: error: ‘T’ was not declared in this scope 116 | ll T; cin >> T; | ^ In file included from /usr/include/c++/14/ext/alloc_traits.h:34, from /usr/include/c++/14/bits/basic_string.h:39, from /usr/include/c++/14/string:54, from /usr/include/c++/14/bitset:52, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:52, from answer.code:1: /usr/include/c++/14/bits/alloc_traits.h: In instantiation of ‘static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::array<long long int, 2>; _Args = {long long int&, long long int&}; _Tp = std::array<long long int, 2>; allocator_type = std::allocator<std::array<long long int, 2> >]’: /usr/include/c++/14/bits/vector.tcc:117:30: required from ‘constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {long long int&, long long int&}; _Tp = std::array<long long int, 2>; _Alloc = std::allocator<std::array<long long int, 2> >; reference = std::array<long long int, 2>&]’ 117 | _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:754:18: required from ‘void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {long long int&, long long int&}; _Tp = std::array<long long int, 2>; _Sequence = std::vector<std::array<long long int, 2> >; _Compare = std::greater<std::array<long long int, 2> >]’ 754 | c.emplace_back(std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ answer.code:89:15: required from here 89 | pq.emplace(dist[r], r); | ~~~~~~~~~~^~~~~~~~~~~~ /usr/include/c++/14/bits/alloc_traits.h:536:28: error: no matching function for call to ‘construct_at(std::array<long long int, 2>*&, long long int&, long long int&)’ 536 | std::construct_at(__p, std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ In file included from /usr/include/c++/14/bits/stl_iterator.h:78, from /usr/include/c++/14/bits/stl_algobase.h:67, from /usr/include/c++/14/algorithm:60, from /usr/include/x86_64-linux-gnu/c++/14/bits/stdc++.h:51: /usr/include/c++/14/bits/stl_construct.h:94:5: note: candidate: ‘template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...)’ 94 | construct_at(_Tp* __location, _Args&&... __args) | ^~~~~~~~~~~~ /usr/include/c++/14/bits/stl_construct.h:94:5: note: template argument deduction/substitution failed: /usr/include/c++/14/bits/stl_construct.h: In substitution of ‘template<class _Tp, class ... _Args> constexpr decltype (::new(void*(0)) _Tp) std::construct_at(_Tp*, _Args&& ...) [with _Tp = std::array<long long int, 2>; _Args = {long long int&, long long int&}]’: /usr/include/c++/14/bits/alloc_traits.h:536:21: required from ‘static constexpr void std::allocator_traits<std::allocator<_CharT> >::construct(allocator_type&, _Up*, _Args&& ...) [with _Up = std::array<long long int, 2>; _Args = {long long int&, long long int&}; _Tp = std::array<long long int, 2>; allocator_type = std::allocator<std::array<long long int, 2> >]’ 536 | std::construct_at(__p, std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/vector.tcc:117:30: required from ‘constexpr std::vector<_Tp, _Alloc>::reference std::vector<_Tp, _Alloc>::emplace_back(_Args&& ...) [with _Args = {long long int&, long long int&}; _Tp = std::array<long long int, 2>; _Alloc = std::allocator<std::array<long long int, 2> >; reference = std::array<long long int, 2>&]’ 117 | _Alloc_traits::construct(this->_M_impl, this->_M_impl._M_finish, | ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ 118 | std::forward<_Args>(__args)...); | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ /usr/include/c++/14/bits/stl_queue.h:754:18: required from ‘void std::priority_queue<_Tp, _Sequence, _Compare>::emplace(_Args&& ...) [with _Args = {long long int&, long long int&}; _Tp = std::array<long long int, 2>; _Sequence = std::vector<std::array<long long int, 2> >; _Compare = std::greater<std::array<long long int, 2> >]’ 754 | c.emplace_back(std::forward<_Args>(__args)...); | ...