Submission #69075580


Source Code Expand

#include<bits/stdc++.h>
#include<atcoder/all>
using namespace std;
using namespace atcoder;
typedef long long int ll;
typedef long double ld;
typedef vector<int> vi;
typedef vector<ll> vl;
typedef vector<vl> vvl;
typedef vector<vvl> vvvl;
typedef vector<vvvl> vvvvl;
typedef vector<bool> vb;      
typedef vector<vb> vvb;
typedef vector<vvb> vvvb;
typedef vector<vvvb> vvvvb;
typedef pair<ll,ll> pl;
typedef pair<ll,pl> ppl;
typedef pair<ll,ppl> pppl;
typedef pair<ll,pppl> pppppl;
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b)-1;i>=(a);i--)
#define all(a) begin(a),end(a)
#define sz(a) (int)(a).size()
#define F first
#define S second
#define bs(A,x) binary_search(all(A),x)
#define lb(A,x) (ll)(lower_bound(all(A),x)-A.begin())
#define ub(A,x) (ll)(upper_bound(all(A),x)-A.begin())
#define cou(A,x) (ll)(upper_bound(all(A),x)-lower_bound(all(A),x))
template<typename T>using min_priority_queue=priority_queue<T,vector<T>,greater<T>>;
template<class T>bool chmax(T&a,T b){if(a<b){a=b;return 1;}return 0;}
template<class T>bool chmin(T&a,T b){if(b<a){a=b;return 1;}return 0;}
//*
using mint=modint998244353;
const ll mod=998244353;
//*/
/*
using mint=modint1000000007;
const ll mod=1000000007;
//*/
//using mint=modint;
//*
typedef vector<mint> vm;
typedef vector<vm> vvm;
typedef vector<vvm> vvvm;
typedef vector<vvvm> vvvvm;
ostream&operator<<(ostream&os,mint a){os<<a.val();return os;}
istream&operator>>(istream&is,mint&a){int x;is>>x;a=mint(x);return is;}
//*/
template<typename T1,typename T2>ostream&operator<<(ostream&os,pair<T1,T2>p){os<<p.F<<" "<<p.S;return os;}
template<typename T1,typename T2>istream&operator>>(istream&is,pair<T1,T2>&p){is>>p.F>>p.S;return is;}
template<typename T>ostream&operator<<(ostream&os,vector<T>v){rep(i,0,sz(v))os<<v[i]<<(i+1!=sz(v)?" ":"");return os;}
template<typename T>istream&operator>>(istream&is,vector<T>&v){for(T&in:v)is>>in;return is;}
int main(){
  cin.tie(0)->sync_with_stdio(0);
  cin.exceptions(cin.failbit);
  ll N;cin>>N;
  vl A(N);cin>>A;
  vvm DP(1024,vm(1024,1));
  rep(i,0,N){
    rep(j,0,1024)if((j&A[i])==A[i]%1024)DP[A[i]>>10][j]*=A[i];
    mint ans=1;
    rep(j,0,1<<10)if(((A[i]>>10)&j)==j)ans*=DP[j][A[i]%1024];
    cout<<ans<<endl;
  }
  return 0;
}

Submission Info

Submission Time
Task E - Subset Product Problem
User TKTYI
Language C++ 20 (gcc 12.2)
Score 700
Code Size 2315 Byte
Status AC
Exec Time 2383 ms
Memory 11712 KiB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 700 / 700
Status
AC × 3
AC × 59
Set Name Test Cases
Sample 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt
All 00_sample_00.txt, 00_sample_01.txt, 00_sample_02.txt, 01_handmade_00.txt, 01_handmade_01.txt, 01_handmade_02.txt, 01_handmade_03.txt, 01_handmade_04.txt, 01_handmade_05.txt, 01_handmade_06.txt, 02_small_00.txt, 02_small_01.txt, 02_small_02.txt, 02_small_03.txt, 02_small_04.txt, 02_small_05.txt, 02_small_06.txt, 03_random_00.txt, 03_random_01.txt, 03_random_02.txt, 03_random_03.txt, 03_random_04.txt, 03_random_05.txt, 03_random_06.txt, 03_random_07.txt, 03_random_08.txt, 03_random_09.txt, 03_random_10.txt, 03_random_11.txt, 03_random_12.txt, 03_random_13.txt, 03_random_14.txt, 03_random_15.txt, 03_random_16.txt, 03_random_17.txt, 03_random_18.txt, 03_random_19.txt, 03_random_20.txt, 03_random_21.txt, 03_random_22.txt, 03_random_23.txt, 03_random_24.txt, 03_random_25.txt, 03_random_26.txt, 03_random_27.txt, 03_random_28.txt, 03_random_29.txt, 03_random_30.txt, 03_random_31.txt, 03_random_32.txt, 03_random_33.txt, 03_random_34.txt, 03_random_35.txt, 03_random_36.txt, 03_random_37.txt, 03_random_38.txt, 03_random_39.txt, 03_random_40.txt, 03_random_41.txt
Case Name Status Exec Time Memory
00_sample_00.txt AC 3 ms 7244 KiB
00_sample_01.txt AC 3 ms 7344 KiB
00_sample_02.txt AC 2 ms 7168 KiB
01_handmade_00.txt AC 2 ms 7332 KiB
01_handmade_01.txt AC 1114 ms 11612 KiB
01_handmade_02.txt AC 1146 ms 10412 KiB
01_handmade_03.txt AC 1185 ms 10412 KiB
01_handmade_04.txt AC 1098 ms 11704 KiB
01_handmade_05.txt AC 2383 ms 11644 KiB
01_handmade_06.txt AC 2281 ms 11660 KiB
02_small_00.txt AC 11 ms 7292 KiB
02_small_01.txt AC 6 ms 7336 KiB
02_small_02.txt AC 8 ms 7336 KiB
02_small_03.txt AC 14 ms 7288 KiB
02_small_04.txt AC 21 ms 7400 KiB
02_small_05.txt AC 33 ms 7216 KiB
02_small_06.txt AC 13 ms 7336 KiB
03_random_00.txt AC 7 ms 7260 KiB
03_random_01.txt AC 1059 ms 10520 KiB
03_random_02.txt AC 143 ms 7516 KiB
03_random_03.txt AC 202 ms 7788 KiB
03_random_04.txt AC 821 ms 9444 KiB
03_random_05.txt AC 1255 ms 11600 KiB
03_random_06.txt AC 1255 ms 11640 KiB
03_random_07.txt AC 1254 ms 11600 KiB
03_random_08.txt AC 1258 ms 11680 KiB
03_random_09.txt AC 1260 ms 11624 KiB
03_random_10.txt AC 1169 ms 11712 KiB
03_random_11.txt AC 1171 ms 11680 KiB
03_random_12.txt AC 1157 ms 10432 KiB
03_random_13.txt AC 1200 ms 10568 KiB
03_random_14.txt AC 1282 ms 11656 KiB
03_random_15.txt AC 2280 ms 11652 KiB
03_random_16.txt AC 2277 ms 11612 KiB
03_random_17.txt AC 2279 ms 11624 KiB
03_random_18.txt AC 2283 ms 11680 KiB
03_random_19.txt AC 2285 ms 11648 KiB
03_random_20.txt AC 2290 ms 11656 KiB
03_random_21.txt AC 1145 ms 10464 KiB
03_random_22.txt AC 1144 ms 10428 KiB
03_random_23.txt AC 1128 ms 10408 KiB
03_random_24.txt AC 1127 ms 10432 KiB
03_random_25.txt AC 1114 ms 10500 KiB
03_random_26.txt AC 1115 ms 10480 KiB
03_random_27.txt AC 2195 ms 11644 KiB
03_random_28.txt AC 2195 ms 11664 KiB
03_random_29.txt AC 2269 ms 11652 KiB
03_random_30.txt AC 2270 ms 11668 KiB
03_random_31.txt AC 2276 ms 11636 KiB
03_random_32.txt AC 2276 ms 11616 KiB
03_random_33.txt AC 2192 ms 10336 KiB
03_random_34.txt AC 2188 ms 10364 KiB
03_random_35.txt AC 2278 ms 11652 KiB
03_random_36.txt AC 2275 ms 11620 KiB
03_random_37.txt AC 2278 ms 11664 KiB
03_random_38.txt AC 2282 ms 11652 KiB
03_random_39.txt AC 1692 ms 10456 KiB
03_random_40.txt AC 1711 ms 11344 KiB
03_random_41.txt AC 1709 ms 11676 KiB