結果
問題 | No.2592 おでぶなおばけさん 2 |
ユーザー | Misuki |
提出日時 | 2024-02-08 22:09:57 |
言語 | C++23 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 209 ms / 2,500 ms |
コード長 | 5,557 bytes |
コンパイル時間 | 2,736 ms |
コンパイル使用メモリ | 214,032 KB |
実行使用メモリ | 92,440 KB |
最終ジャッジ日時 | 2024-09-28 12:53:18 |
合計ジャッジ時間 | 23,838 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 150 ms
89,756 KB |
testcase_01 | AC | 163 ms
89,624 KB |
testcase_02 | AC | 169 ms
89,748 KB |
testcase_03 | AC | 156 ms
89,756 KB |
testcase_04 | AC | 160 ms
89,628 KB |
testcase_05 | AC | 188 ms
89,752 KB |
testcase_06 | AC | 171 ms
89,756 KB |
testcase_07 | AC | 175 ms
89,624 KB |
testcase_08 | AC | 176 ms
89,752 KB |
testcase_09 | AC | 156 ms
89,752 KB |
testcase_10 | AC | 162 ms
89,624 KB |
testcase_11 | AC | 173 ms
89,620 KB |
testcase_12 | AC | 155 ms
89,624 KB |
testcase_13 | AC | 198 ms
91,288 KB |
testcase_14 | AC | 195 ms
91,288 KB |
testcase_15 | AC | 181 ms
90,776 KB |
testcase_16 | AC | 196 ms
91,284 KB |
testcase_17 | AC | 200 ms
91,672 KB |
testcase_18 | AC | 186 ms
90,904 KB |
testcase_19 | AC | 180 ms
90,396 KB |
testcase_20 | AC | 184 ms
90,900 KB |
testcase_21 | AC | 164 ms
90,520 KB |
testcase_22 | AC | 191 ms
91,544 KB |
testcase_23 | AC | 202 ms
91,676 KB |
testcase_24 | AC | 192 ms
91,160 KB |
testcase_25 | AC | 176 ms
90,264 KB |
testcase_26 | AC | 178 ms
90,264 KB |
testcase_27 | AC | 207 ms
92,108 KB |
testcase_28 | AC | 209 ms
92,312 KB |
testcase_29 | AC | 199 ms
92,184 KB |
testcase_30 | AC | 201 ms
92,184 KB |
testcase_31 | AC | 201 ms
92,180 KB |
testcase_32 | AC | 197 ms
92,092 KB |
testcase_33 | AC | 202 ms
92,180 KB |
testcase_34 | AC | 196 ms
92,316 KB |
testcase_35 | AC | 201 ms
92,184 KB |
testcase_36 | AC | 200 ms
92,312 KB |
testcase_37 | AC | 199 ms
92,180 KB |
testcase_38 | AC | 200 ms
92,212 KB |
testcase_39 | AC | 200 ms
92,308 KB |
testcase_40 | AC | 203 ms
92,312 KB |
testcase_41 | AC | 200 ms
92,180 KB |
testcase_42 | AC | 201 ms
92,184 KB |
testcase_43 | AC | 194 ms
92,180 KB |
testcase_44 | AC | 199 ms
92,184 KB |
testcase_45 | AC | 196 ms
92,312 KB |
testcase_46 | AC | 200 ms
92,312 KB |
testcase_47 | AC | 191 ms
92,184 KB |
testcase_48 | AC | 196 ms
92,188 KB |
testcase_49 | AC | 191 ms
92,184 KB |
testcase_50 | AC | 195 ms
92,184 KB |
testcase_51 | AC | 193 ms
92,184 KB |
testcase_52 | AC | 200 ms
92,184 KB |
testcase_53 | AC | 202 ms
92,184 KB |
testcase_54 | AC | 203 ms
92,440 KB |
testcase_55 | AC | 201 ms
92,184 KB |
testcase_56 | AC | 196 ms
92,312 KB |
testcase_57 | AC | 173 ms
89,748 KB |
testcase_58 | AC | 200 ms
92,308 KB |
testcase_59 | AC | 200 ms
92,308 KB |
testcase_60 | AC | 199 ms
92,312 KB |
testcase_61 | AC | 198 ms
92,312 KB |
testcase_62 | AC | 202 ms
92,252 KB |
testcase_63 | AC | 196 ms
92,184 KB |
testcase_64 | AC | 203 ms
92,188 KB |
testcase_65 | AC | 198 ms
92,180 KB |
testcase_66 | AC | 197 ms
92,128 KB |
testcase_67 | AC | 194 ms
92,308 KB |
testcase_68 | AC | 199 ms
92,324 KB |
testcase_69 | AC | 190 ms
92,312 KB |
testcase_70 | AC | 199 ms
92,188 KB |
testcase_71 | AC | 197 ms
92,312 KB |
testcase_72 | AC | 196 ms
92,184 KB |
testcase_73 | AC | 195 ms
92,312 KB |
testcase_74 | AC | 136 ms
89,624 KB |
testcase_75 | AC | 201 ms
92,184 KB |
testcase_76 | AC | 197 ms
92,160 KB |
testcase_77 | AC | 198 ms
92,308 KB |
testcase_78 | AC | 196 ms
92,188 KB |
testcase_79 | AC | 201 ms
92,312 KB |
testcase_80 | AC | 206 ms
92,184 KB |
testcase_81 | AC | 202 ms
92,312 KB |
testcase_82 | AC | 202 ms
92,184 KB |
testcase_83 | AC | 198 ms
92,184 KB |
ソースコード
#pragma GCC optimize("O2") #include <algorithm> #include <array> #include <bit> #include <bitset> #include <cassert> #include <cctype> #include <cfenv> #include <cfloat> #include <chrono> #include <cinttypes> #include <climits> #include <cmath> #include <compare> #include <complex> #include <concepts> #include <cstdarg> #include <cstddef> #include <cstdint> #include <cstdio> #include <cstdlib> #include <cstring> #include <deque> #include <fstream> #include <functional> #include <initializer_list> #include <iomanip> #include <ios> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <map> #include <memory> #include <new> #include <numbers> #include <numeric> #include <ostream> #include <queue> #include <random> #include <ranges> #include <set> #include <span> #include <sstream> #include <stack> #include <streambuf> #include <string> #include <tuple> #include <type_traits> #include <variant> #define int ll #define INT128_MAX (__int128)(((unsigned __int128) 1 << ((sizeof(__int128) * __CHAR_BIT__) - 1)) - 1) #define INT128_MIN (-INT128_MAX - 1) #define clock chrono::steady_clock::now().time_since_epoch().count() #ifdef DEBUG #define dbg(x) cout << (#x) << " = " << x << '\n' #else #define dbg(x) #endif namespace R = std::ranges; namespace V = std::views; using namespace std; using ll = long long; using ull = unsigned long long; using ldb = long double; using pii = pair<int, int>; using pll = pair<ll, ll>; //#define double ldb template<class T> ostream& operator<<(ostream& os, const pair<T, T> pr) { return os << pr.first << ' ' << pr.second; } template<class T, size_t N> ostream& operator<<(ostream& os, const array<T, N> &arr) { for(const T &X : arr) os << X << ' '; return os; } template<class T> ostream& operator<<(ostream& os, const vector<T> &vec) { for(const T &X : vec) os << X << ' '; return os; } template<class T> ostream& operator<<(ostream& os, const set<T> &s) { for(const T &x : s) os << x << ' '; return os; } //note: inversion only works when MOD is a prime struct mint { static long long MOD; long long _val; mint(long long init = 0) { _val = init % MOD; (*this).norm(); } mint POW(long long index) { if (index == 0) return mint(1ll); mint base = *this; mint res = (base == 0ll ? 0ll : 1ll); while(index) { if (index & 1) res *= base; base *= base, index >>= 1; } return res; } mint inv() { return (*this).POW(MOD - 2); } mint& norm() { if (_val >= MOD) _val -= MOD; if (_val < 0) _val += MOD; return *this; } mint& operator+=(mint b) { _val += b._val; return (*this).norm(); } mint& operator-=(mint b) { _val -= b._val; return (*this).norm(); } mint& operator*=(mint b) { _val = (_val * b._val) % MOD; return *this; } mint& operator/=(mint b) { _val = (_val * b.inv()._val) % MOD; return *this; } mint& operator++() { _val += 1; return (*this).norm(); } mint& operator--() { _val -= 1; return (*this).norm(); } mint operator++(signed) { mint tmp = *this; ++(*this); return tmp; } mint operator--(signed) { mint tmp = *this; --(*this); return tmp; } mint operator-() { return mint(-_val); } bool operator==(mint b) { return _val == b._val; } bool operator!=(mint b) { return _val != b._val; } friend mint operator+(mint a, mint b) { return a += b; } friend mint operator-(mint a, mint b) { return a -= b; } friend mint operator*(mint a, mint b) { return a *= b; } friend mint operator/(mint a, mint b) { return a /= b; } friend ostream& operator<<(ostream& os, const mint& b) { return os << b._val; } friend istream& operator>>(istream& is, mint& b) { long long val; is >> val; b = mint(val); return is; } }; ll mint::MOD = 2; const int C = 10000001; vector<int> prime; int mpf[C]; void sieve() { for(int i = 1; i < C; i++) mpf[i] = i; for(int i = 2; i < C; i++) { if (mpf[i] == i) prime.emplace_back(i); for(int P : prime) { if (P > mpf[i] or i * P >= C) break; mpf[i * P] = P; } } } vector<pii> factorize(int val) { vector<pii> res; while(val > 1) { int p = mpf[val]; res.emplace_back(p, 0); while(val % p == 0) res.back().second += 1, val /= p; } return res; } vector<int> factors(int val) { vector<int> res(1, 1); for(auto [p, idx] : factorize(val)) { vector<int> tmp; for(int i = 0, base = 1; i <= idx; i++, base *= p) for(int X : res) tmp.emplace_back(X * base); res.swap(tmp); } return res; } mt19937 rng(clock); uniform_int_distribution<int> unif(600000, 664578); bool ans[100000]; void calc(int n, int k, vector<int> a, vector<array<int, 2>> query) { while(k % (mint::MOD = unif(rng)) == 0); vector<mint> b(n + 1); mint tmp = k; for(int i = 1; i <= n; i++) b[i] = a[i] * tmp, tmp *= k; partial_sum(b.begin(), b.end(), b.begin()); for(int i = 0; auto [l, r] : query) ans[i] = ans[i] or (b[r] - b[l - 1] != 0), i++; } signed main() { ios::sync_with_stdio(false), cin.tie(NULL); sieve(); int n, q, k; cin >> n >> q >> k; vector<int> a(n + 1); for(int i = 1; i <= n; i++) cin >> a[i]; vector<array<int, 2>> query(q); for(auto &[l, r] : query) cin >> l >> r; for(int iter = 0; iter < 5; iter++) calc(n, k, a, query); for(int i = 0; i < q; i++) cout << (ans[i] ? "Yes\n" : "No\n"); return 0; }