ログイン
新規登録
AtsuoCoder Waseda Tour Finals 2025
読込中…
Home
Tasks
Clar
Submissions
Standings
提出 d4725b4e-92ee-4d4d-a0fc-da554540ca4d
コード
#include <bits/stdc++.h> using namespace std; #include <atcoder/all> using namespace atcoder; using ll = long long; using xy = pair<ll, ll>; xy op(xy a, xy b) { if (a == e()) return b; else if (b == e()) return a; if (a == {0ll, 0ll} || b == {0ll, 0ll}) return {0ll, 0ll}; xy res = crt(vector<ll>{a.first, b.first}, vector<ll>{a.second, b.second}); if (res == {0ll, 0ll}) return {0ll, 0ll}; else if (res.first >= INT_MAX) return {0ll, 0ll}; else return res; } xy e() { return {-1ll, -1ll}; } int main() { ll n; cin >> n; vector<ll> a(n), b(n); for (int i = 0; i < n; i++) cin >> a[i] >> b[i]; vector<xy> init(n); for (int i = 0; i < n; i++) init[i].first = a[i], init[i].second = b[i]; segtree<xy, op, e> seg(init); int q; cin >> q; while (q--) { int l, r; cin >> l >> r; xy res = seg.prod(--l, r); if (res == {0, 0} || res.first >= INT_MAX) cout << -1 << endl; else cout << res.first << endl; } }
結果
問題
点数
言語
結果
実行時間
メモリ
I - Segment CRT
0
C++
WJ
0 ms
0 KiB
コンパイルエラー
Main.cpp: In function 'xy op(xy, xy)': Main.cpp:9:14: error: 'e' was not declared in this scope; did you mean 'std::numbers::e'? 9 | if (a == e()) return b; | ^ | std::numbers::e In file included from /usr/include/c++/13/bits/max_size_type.h:37, from /usr/include/c++/13/bits/ranges_base.h:39, from /usr/include/c++/13/bits/ranges_algobase.h:38, from /usr/include/c++/13/bits/ranges_algo.h:38, from /usr/include/c++/13/algorithm:63, from /usr/include/x86_64-linux-gnu/c++/13/bits/stdc++.h:51, from Main.cpp:1: /usr/include/c++/13/numbers:122:27: note: 'std::numbers::e' declared here 122 | inline constexpr double e = e_v<double>; | ^ Main.cpp:11:14: error: expected primary-expression before '{' token 11 | if (a == {0ll, 0ll} || b == {0ll, 0ll}) return {0ll, 0ll}; | ^ Main.cpp:11:13: error: expected ')' before '{' token 11 | if (a == {0ll, 0ll} || b == {0ll, 0ll}) return {0ll, 0ll}; | ~ ^~ | ) Main.cpp:13:16: error: expected primary-expression before '{' token 13 | if (res == {0ll, 0ll}) return {0ll, 0ll}; | ^ Main.cpp:13:15: error: expected ')' before '{' token 13 | if (res == {0ll, 0ll}) return {0ll, 0ll}; | ~ ^~ | ) Main.cpp: In function 'int main()': Main.cpp:33:20: error: expected primary-expression before '{' token 33 | if (res == {0, 0} || res.first >= INT_MAX) cout << -1 << endl; | ^ Main.cpp:33:19: error: expected ')' before '{' token 33 | if (res == {0, 0} || res.first >= INT_MAX) cout << -1 << endl; | ~ ^~ | ) Main.cpp: In function 'xy op(xy, xy)': Main.cpp:16:1: warning: control reaches end of non-void function [-Wreturn-type] 16 | } | ^