結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー | masutech16 |
提出日時 | 2020-12-01 21:36:25 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
RE
|
実行時間 | - |
コード長 | 5,315 bytes |
コンパイル時間 | 2,240 ms |
コンパイル使用メモリ | 203,588 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 11:44:23 |
合計ジャッジ時間 | 33,820 ms |
ジャッジサーバーID (参考情報) |
judge5 / judge2 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,940 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | RE | - |
testcase_04 | RE | - |
testcase_05 | RE | - |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | RE | - |
testcase_08 | RE | - |
testcase_09 | RE | - |
testcase_10 | RE | - |
testcase_11 | RE | - |
testcase_12 | RE | - |
testcase_13 | RE | - |
testcase_14 | RE | - |
testcase_15 | RE | - |
testcase_16 | RE | - |
testcase_17 | RE | - |
testcase_18 | RE | - |
testcase_19 | RE | - |
testcase_20 | AC | 2 ms
6,944 KB |
testcase_21 | RE | - |
testcase_22 | RE | - |
testcase_23 | RE | - |
testcase_24 | RE | - |
testcase_25 | RE | - |
testcase_26 | RE | - |
testcase_27 | RE | - |
testcase_28 | RE | - |
testcase_29 | RE | - |
testcase_30 | AC | 2 ms
6,940 KB |
testcase_31 | RE | - |
testcase_32 | RE | - |
testcase_33 | RE | - |
testcase_34 | RE | - |
testcase_35 | RE | - |
testcase_36 | RE | - |
testcase_37 | RE | - |
testcase_38 | AC | 2 ms
6,944 KB |
testcase_39 | AC | 2 ms
6,944 KB |
testcase_40 | RE | - |
testcase_41 | RE | - |
testcase_42 | RE | - |
testcase_43 | RE | - |
testcase_44 | RE | - |
04_evil_A_01 | RE | - |
04_evil_A_02 | RE | - |
04_evil_A_03 | RE | - |
04_evil_A_04 | RE | - |
04_evil_A_05 | RE | - |
04_evil_A_06 | RE | - |
04_evil_A_07 | RE | - |
04_evil_A_08 | RE | - |
04_evil_A_09 | RE | - |
04_evil_A_10 | RE | - |
05_evil_B_01 | WA | - |
05_evil_B_02 | RE | - |
05_evil_B_03 | RE | - |
05_evil_B_04 | RE | - |
05_evil_B_05 | RE | - |
05_evil_B_06 | RE | - |
05_evil_B_07 | RE | - |
05_evil_B_08 | RE | - |
05_evil_B_09 | RE | - |
05_evil_B_10 | WA | - |
06_evil_C_01 | TLE | - |
06_evil_C_02 | TLE | - |
06_evil_C_03 | TLE | - |
06_evil_C_04 | TLE | - |
06_evil_C_05 | TLE | - |
06_evil_C_06 | TLE | - |
06_evil_C_07 | TLE | - |
06_evil_C_08 | TLE | - |
06_evil_C_09 | TLE | - |
06_evil_C_10 | AC | 2 ms
6,944 KB |
ソースコード
#line 1 "/workspaces/compro/lib/math/modint.hpp" #include <cassert> #include <cstdint> #include <iostream> #include <vector> #ifndef MOD_INT #define MOD_INT template <std::uint_fast64_t MOD> class ModInt { using u64 = std::uint_fast64_t; public: ModInt(const u64 val = 0) { value = val % MOD; } ModInt operator+(const ModInt rhs) const { return ModInt(*this) += rhs; } ModInt operator-(const ModInt rhs) const { return ModInt(*this) -= rhs; } ModInt operator*(const ModInt rhs) const { return ModInt(*this) *= rhs; } ModInt operator/(const ModInt rhs) const { return ModInt(*this) /= rhs; } ModInt &operator+=(const ModInt rhs) { value += rhs.value; if (value >= MOD) { value -= MOD; } return *this; } ModInt &operator-=(const ModInt rhs) { if (value < rhs.value) { value += MOD; } value -= rhs.value; return *this; } ModInt &operator*=(const ModInt rhs) { value = value * rhs.value % MOD; return *this; } ModInt &operator/=(ModInt rhs) { *this *= rhs.inv(); return *this; } ModInt &operator++(int n) { value++; if (value >= MOD) { value -= MOD; } return *this; } ModInt &operator--(int n) { if (value == 0) { value += MOD; } value--; return *this; } ModInt inv() { return ModInt::pow(*this, MOD - 2); } static ModInt pow(ModInt base, long long int n) { ModInt res = ModInt(1); while (n) { if (n & 1) { res *= base; } base *= base; n /= 2; } return res; } static ModInt comb(ModInt n, ModInt r) { return comb(n.value, r.value); } static ModInt comb(int n, int r) { if (n < r) return ModInt(0); ModInt res = ModInt(1); for (int i = 0; i < r; i++) { res *= ModInt(n - i); } ModInt inv = ModInt(1); for (int i = 0; i < r; i++) { inv *= ModInt(r - i); } return res / inv; } // nC0からnCnまでを計算する。計算量はO(n) // @param n 要素数 // @param vec 結果を格納する配列 static void combination_table(int n, std::vector<ModInt> &vec) { assert(static_cast<int>(vec.size()) >= n + 1); vec[0] = ModInt(1); for (int r = 1; r < n + 1; r++) { vec[r] = vec[r - 1] * ModInt(n - r + 1) / ModInt(r); } } u64 getValue() const { return value; } private: u64 value; friend std::ostream &operator<<(std::ostream &out, const ModInt<MOD> &m) { out << m.value; return out; } friend std::istream &operator>>(std::istream &in, ModInt &m) { uint_fast64_t i; in >> i; m = ModInt(i); return in; } }; #endif #line 1 "/workspaces/compro/lib/template.hpp" #line 3 "/workspaces/compro/lib/io/vector.hpp" #ifndef IO_VECTOR #define IO_VECTOR template <class T> std::ostream &operator<<(std::ostream &out, const std::vector<T> &v) { int size = v.size(); for (int i = 0; i < size; i++) { std::cout << v[i]; if (i != size - 1) std::cout << " "; } return out; } template <class T> std::istream &operator>>(std::istream &in, std::vector<T> &v) { for (auto &el : v) { std::cin >> el; } return in; } #endif #line 4 "/workspaces/compro/lib/template.hpp" #include <bits/stdc++.h> #define REP(i, n) for (int i = 0; i < n; i++) #define FOR(i, m, n) for (int i = m; i < n; i++) #define ALL(v) (v).begin(), (v).end() #define coutd(n) cout << fixed << setprecision(n) #define ll long long int #define vl vector<ll> #define vi vector<int> #define MM << " " << using namespace std; template <class T> void say(bool val, T yes, T no) { cout << (val ? yes : no) << "\n"; } void say(bool val, string yes = "Yes", string no = "No") { say<string>(val, yes, no); } template <class T> void chmin(T &a, T b) { if (a > b) a = b; } template <class T> void chmax(T &a, T b) { if (a < b) a = b; } // C++ 17に完全移行したら消す // 最大公約数を求める template <class T> T gcd(T n, T m) { return n ? gcd(m % n, n) : m; } // 最小公倍数を求める template <class T> T lcm(T n, T m) { T g = gcd(n, m); return (n / g) * m; } // 重複を消す。計算量はO(NlogN) template <class T> void unique(std::vector<T> &v) { std::sort(v.begin(), v.end()); v.erase(std::unique(v.begin(), v.end()), v.end()); } #line 3 "main.cpp" constexpr long long MOD = 998244353; using mint = ModInt<MOD>; mint solve(long long N, ll K, long long X, long long Y, const std::vector<long long> &A) { mint ans = 0; ll loop = 1; REP(i, N) { loop *= K; } ll sup = 1; REP(i, 15) { sup *= 2; } assert(loop <= sup); REP(i, loop) { ll tmp = i; int x = 0; int prev = -1; bool ok = true; REP(j, N) { int idx = tmp % K; if (prev == A[idx]) { ok = false; break; } prev = A[idx]; x = x ^ A[idx]; tmp /= K; } if (ok && X <= x && x <= Y) { ans++; } } return ans; } // generated by online-judge-template-generator v4.7.1 (https://github.com/online-judge-tools/template-generator) int main() { int N; long long K; long long X, Y; std::cin >> N >> K; std::vector<long long> A(K); std::cin >> X >> Y; for (int i = 0; i < K; ++i) { std::cin >> A[i]; } auto ans = solve(N, K, X, Y, A); std::cout << ans << std::endl; return 0; }