結果
問題 | No.1304 あなたは基本が何か知っていますか?私は知っています. |
ユーザー | carrot46 |
提出日時 | 2020-12-01 12:57:59 |
言語 | C++14 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 4 ms / 2,000 ms |
コード長 | 3,091 bytes |
コンパイル時間 | 2,011 ms |
コンパイル使用メモリ | 179,244 KB |
実行使用メモリ | 6,948 KB |
最終ジャッジ日時 | 2024-06-12 10:05:59 |
合計ジャッジ時間 | 8,945 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,816 KB |
testcase_02 | AC | 2 ms
6,816 KB |
testcase_03 | AC | 2 ms
6,944 KB |
testcase_04 | AC | 3 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,944 KB |
testcase_06 | AC | 2 ms
6,940 KB |
testcase_07 | AC | 3 ms
6,944 KB |
testcase_08 | AC | 2 ms
6,944 KB |
testcase_09 | AC | 3 ms
6,944 KB |
testcase_10 | AC | 3 ms
6,940 KB |
testcase_11 | AC | 3 ms
6,940 KB |
testcase_12 | AC | 3 ms
6,940 KB |
testcase_13 | AC | 2 ms
6,944 KB |
testcase_14 | AC | 3 ms
6,940 KB |
testcase_15 | AC | 2 ms
6,940 KB |
testcase_16 | AC | 3 ms
6,940 KB |
testcase_17 | AC | 2 ms
6,944 KB |
testcase_18 | AC | 3 ms
6,940 KB |
testcase_19 | AC | 2 ms
6,944 KB |
testcase_20 | AC | 2 ms
6,944 KB |
testcase_21 | AC | 2 ms
6,944 KB |
testcase_22 | AC | 3 ms
6,940 KB |
testcase_23 | AC | 3 ms
6,940 KB |
testcase_24 | AC | 4 ms
6,940 KB |
testcase_25 | AC | 2 ms
6,940 KB |
testcase_26 | AC | 2 ms
6,940 KB |
testcase_27 | AC | 3 ms
6,940 KB |
testcase_28 | AC | 2 ms
6,940 KB |
testcase_29 | AC | 2 ms
6,940 KB |
testcase_30 | AC | 2 ms
6,940 KB |
testcase_31 | AC | 2 ms
6,944 KB |
testcase_32 | AC | 2 ms
6,944 KB |
testcase_33 | AC | 2 ms
6,944 KB |
testcase_34 | AC | 2 ms
6,944 KB |
testcase_35 | AC | 2 ms
6,940 KB |
testcase_36 | AC | 2 ms
6,944 KB |
testcase_37 | AC | 2 ms
6,944 KB |
testcase_38 | AC | 2 ms
6,940 KB |
testcase_39 | AC | 2 ms
6,948 KB |
testcase_40 | AC | 2 ms
6,940 KB |
testcase_41 | AC | 2 ms
6,940 KB |
testcase_42 | AC | 2 ms
6,944 KB |
testcase_43 | AC | 2 ms
6,944 KB |
testcase_44 | AC | 2 ms
6,940 KB |
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 | RE | - |
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 | RE | - |
06_evil_C_01 | RE | - |
06_evil_C_02 | RE | - |
06_evil_C_03 | RE | - |
06_evil_C_04 | RE | - |
06_evil_C_05 | RE | - |
06_evil_C_06 | RE | - |
06_evil_C_07 | RE | - |
06_evil_C_08 | RE | - |
06_evil_C_09 | RE | - |
06_evil_C_10 | RE | - |
ソースコード
#include <bits/stdc++.h> //#include <chrono> //#pragma GCC optimize("O3") using namespace std; #define reps(i,s,n) for(int i = s; i < n; i++) #define rep(i,n) reps(i,0,n) #define Rreps(i,n,e) for(int i = n - 1; i >= e; --i) #define Rrep(i,n) Rreps(i,n,0) #define ALL(a) a.begin(), a.end() using ll = long long; using vec = vector<ll>; using mat = vector<vec>; ll N,M,H,W,Q,K,A,B; string S; using P = pair<ll, ll>; const ll INF = (1LL<<60); template<class T> bool chmin(T &a, const T &b){ if(a > b) {a = b; return true;} else return false; } template<class T> bool chmax(T &a, const T &b){ if(a < b) {a = b; return true;} else return false; } template <unsigned long long mod > class modint{ public: ll x; constexpr modint(){x = 0;} constexpr modint(ll _x) : x((_x < 0 ? ((_x += (LLONG_MAX / mod) * mod) < 0 ? _x + (LLONG_MAX / mod) * mod : _x) : _x)%mod){} constexpr modint set_raw(ll _x){ //_x in [0, mod) x = _x; return *this; } constexpr modint operator-(){ return x == 0 ? 0 : mod - x; } constexpr modint& operator+=(const modint& a){ if((x += a.x) >= mod) x -= mod; return *this; } constexpr modint operator+(const modint& a) const{ return modint(*this) += a; } constexpr modint& operator-=(const modint& a){ if((x -= a.x) < 0) x += mod; return *this; } constexpr modint operator-(const modint& a) const{ return modint(*this) -= a; } constexpr modint& operator*=(const modint& a){ (x *= a.x)%=mod; return *this; } constexpr modint operator*(const modint& a) const{ return modint(*this) *= a; } constexpr modint pow(unsigned long long pw) const{ modint res(1), comp(*this); while(pw){ if(pw&1) res *= comp; comp *= comp; pw >>= 1; } return res; } //以下、modが素数のときのみ constexpr modint inv() const{ if(x == 2) return (mod + 1) >> 1; return modint(*this).pow(mod - 2); } constexpr modint& operator/=(const modint &a){ (x *= a.inv().x)%=mod; return *this; } constexpr modint operator/(const modint &a) const{ return modint(*this) /= a; } }; #define mod1 998244353 using mint = modint<mod1>; ostream& operator<<(ostream& os, const mint& a){ os << a.x; return os; } using vm = vector<mint>; int main(){ ll X, Y; cin>>N>>K>>X>>Y; vector<vm> dp(N + 1, vm(1024, 0)); vec a(K); rep(i, K) cin>>a[i]; sort(ALL(a)); a.erase(unique(ALL(a)), a.end()); K = a.size(); dp[0][0] = 1; rep(i, N){ rep(j, 1024){ if(i >= 2) dp[i][j] -= dp[i-2][j] * (K - (i > 2)); //onaji 3renzoku sudeni nai if(dp[i][j].x == 0) continue; rep(k, K) dp[i+1][j ^ a[k]] += dp[i][j]; } //rep(j, 16) cout<<dp[i][j]<<" \n"[j == 15]; } mint res(0); reps(j, X, min(Y + 1, 1024LL)) res += dp[N][j] - dp[N-2][j] * (K - (N > 2)); cout<<res<<endl; }