結果

問題 No.1318 ABCD quadruplets
ユーザー comi_likecomi_like
提出日時 2021-05-04 08:59:10
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 2,320 bytes
コンパイル時間 1,578 ms
コンパイル使用メモリ 171,084 KB
実行使用メモリ 88,072 KB
最終ジャッジ日時 2023-09-30 05:34:08
合計ジャッジ時間 7,547 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 22 ms
88,072 KB
testcase_01 AC 21 ms
81,000 KB
testcase_02 AC 21 ms
81,032 KB
testcase_03 AC 21 ms
81,200 KB
testcase_04 AC 21 ms
81,144 KB
testcase_05 AC 21 ms
80,788 KB
testcase_06 AC 22 ms
80,844 KB
testcase_07 AC 22 ms
80,796 KB
testcase_08 AC 22 ms
80,964 KB
testcase_09 AC 23 ms
81,040 KB
testcase_10 AC 22 ms
81,028 KB
testcase_11 AC 23 ms
80,824 KB
testcase_12 AC 21 ms
80,964 KB
testcase_13 AC 760 ms
80,788 KB
testcase_14 TLE -
testcase_15 -- -
testcase_16 -- -
testcase_17 -- -
testcase_18 -- -
testcase_19 -- -
testcase_20 -- -
testcase_21 -- -
testcase_22 -- -
testcase_23 -- -
testcase_24 -- -
testcase_25 -- -
testcase_26 -- -
testcase_27 -- -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;

typedef long long ll;
const long long INF = 1LL<<60;
const double PI = acos(-1.0);
/*const double PI = atan2(0.0,-1.0)*/
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }
#define rep(i, n) for(ll i = 0; i < (ll)(n); i++)
#define rep1(i,aa,n) for(ll i = aa; i <= (ll)(n); i++)
#define ALL(a)  (a).begin(),(a).end()
#define ar_init(aa,val) rep(i,aa.size()) aa[i]=val;
#define v2d(aa,val1,val2,ini) vector<vector<ll>> aa(val1,vector<ll>(val2,ini));
#define pqe priority_queue<ll>
#define pqeg priority_queue<ll,vector<ll>,greater<ll>>
#define lcin(...) ll __VA_ARGS__;CINT(__VA_ARGS__)
#define eout(...) COU(__VA_ARGS__);
#define sout(...) SCOU(__VA_ARGS__);
#define scin(...) string __VA_ARGS__;CINT(__VA_ARGS__)
#define lb(aa,val) lower_bound(ALL(aa),val)
#define pb push_back
#define mkp make_pair

ll kaijou(ll e){ll r=1;rep(i,e){r*=(i+1);}return r;}

void CINT(){}
template <class Head,class... Tail>
void CINT(Head&& head,Tail&&... tail){
    cin>>head;
    CINT(move(tail)...);
}

void COU(){}
template <class Head,class... Tail>
void COU(Head&& head,Tail&&... tail){
    cout<<head<<endl;
    COU(move(tail)...);
}

void SCOU(){}
template <class Head,class... Tail>
void SCOU(Head&& head,Tail&&... tail){
    cout<<head<<" ";
    SCOU(move(tail)...);
}

template <class T = ll>
T IN(){T x;cin>>x;return (x);}

using pii = pair<ll,ll>;
using v2 = vector<vector<ll>>;
using v1 = vector<ll>;
using v2p = vector<vector<pii>>;
using v1p = vector<pii>;
const ll mo=1000000007;
//const ll mo=998244353;


ll mod_pow(ll N,ll n){
if(n==0) return 1;
ll pp,hh;
pp=n/2;
hh=n%2;
int tt=mod_pow(N,n/2);
if(hh==0)return tt%mo*tt%mo;
else {return tt%mo*tt%mo*N%mo;}
}

vector<ll> ans(10000000,0);
ll n,m;
void dfs(ll ka,ll sum,vector<ll> aa,ll jo){

if(aa.size()==4){
aa.pb(-1);
ll r=0;
ll e=1;
rep(i,4){
if(aa[i]==aa[i+1]){
r++;
}else{
if(r)e*=kaijou(r+1);
r=0;
}

}
ans[sum]+=24/e;
return ;
}

if(m<ka)return ;
if(n<sum)return ;


dfs(ka+1,sum,aa,jo);
aa.pb(ka);
rep(i,aa.size())sum+=ka*aa[i];
dfs(ka,sum,aa,jo);
}


int main(){

//cout<<fixed<<setprecision(15);

cin>>n>>m;
v1 aa;
dfs(0,0,aa,0);
rep(i,n+1){
eout(ans[i]);
}






}
0