結果

問題 No.1318 ABCD quadruplets
ユーザー tsuyu93tsuyu93
提出日時 2020-12-16 12:26:39
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 4,415 bytes
コンパイル時間 2,591 ms
コンパイル使用メモリ 219,584 KB
実行使用メモリ 4,348 KB
最終ジャッジ日時 2023-10-20 09:19:58
合計ジャッジ時間 7,551 ms
ジャッジサーバーID
(参考情報)
judge15 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,348 KB
testcase_01 AC 2 ms
4,348 KB
testcase_02 AC 1 ms
4,348 KB
testcase_03 AC 2 ms
4,348 KB
testcase_04 AC 1 ms
4,348 KB
testcase_05 AC 2 ms
4,348 KB
testcase_06 AC 2 ms
4,348 KB
testcase_07 AC 2 ms
4,348 KB
testcase_08 AC 2 ms
4,348 KB
testcase_09 AC 2 ms
4,348 KB
testcase_10 AC 2 ms
4,348 KB
testcase_11 AC 2 ms
4,348 KB
testcase_12 AC 2 ms
4,348 KB
testcase_13 AC 162 ms
4,348 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 #

/*
             author:ryo3ihara
                   ”継続は力なり、雨だれ石を穿つ”
                      ”slow but steady wins the race”


*/

#pragma GCC optimize("Ofast")
#include<bits/stdc++.h>

//#include<atcoder/all>
//using namespace atcoder;

/* 
// 多倍長テンプレ
#include <boost/multiprecision/cpp_dec_float.hpp>
#include <boost/multiprecision/cpp_int.hpp>
namespace mp = boost::multiprecision;
// 任意長整数型
using Bint = mp::cpp_int;
// 仮数部が1024ビットの浮動小数点数型(TLEしたら小さくする)
using Real = mp::number<mp::cpp_dec_float<1024>>;
*/

using namespace std;
using ll = long long;
using ld = long double;
using pll = pair<ll, ll>;
using pli = pair<ll, int>;
using pii = pair<int, int>;
using pld = pair<ll, ld>;
using ppiii =  pair<pii, int>;
using ppiill = pair<pii, ll>;
using ppllll = pair<pll, ll>;
using pplii = pair<pli, int>;
using mii = map<int, int>;
using dll = deque<ll>;
using qll = queue<ll>;
using pqll = priority_queue<ll>;
using pqrll = priority_queue<ll, vector<ll>, greater<ll>>;
using vint = vector<int>;
using vll = vector<ll>;
using vpll = vector<pll>;
using vvll = vector<vector<ll>>;
using vvint = vector<vector<int>>;
using vvpll = vector<vector<pll>>;

//マクロ
//forループ
#define REP(i,n) for(ll i=0;i<ll(n);i++)
#define REPD(i,n) for(ll i=n-1;i>=0;i--)
#define FOR(i,a,b) for(ll i=a;i<=ll(b);i++)
#define FORD(i,a,b) for(ll i=a;i>=ll(b);i--)
#define ALL(x) x.begin(),x.end() 
#define rALL(x) x.rbegin(),x.rend() 
#define SIZE(x) ll(x.size()) 
#define fs first
#define sc second
#define INF32 2147483647 //2.147483647x10^{9}:32bit整数のinf
#define INF64 9223372036854775807 //9.223372036854775807x10^{18}:64bit整数のinf
//定数
const ll MOD = 1000000007;
const int inf = 1e9;
const ll INF = 1e18;
const ll MAXR = 100000; //10^5:配列の最大のrange

inline void Yes(bool b = true) { cout << (b ? "Yes" : "No") << '\n'; }
inline void YES(bool b = true) { cout << (b ? "YES" : "NO") << '\n'; }

//最大化問題最小化問題
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;
}
//高速冪乗化 modの時は一部入れ替える
ll power(ll a, ll b) {
   ll res=1;
   while (b>0) {
       if (b&1){
            res*=a;
            //res%=MOD;
        }
       b/=2;
       a*=a;
       //a%=MOD;
   }
   return res;
}
ll power2(ll x, ll y) {
    if(y == 0) return 1;
    if(y == 1) {
        return x;
        // return x % MOD;
    }
    ll ans;
    if(y % 2 == 1) {
        ll r = power(x,(y-1)/2);
        //ans = r * r % MOD;
        //ans = ans * x % MOD;
        ans = x * r * r;
    }
    else {
        ll r = power(x,y/2);
        //ans = r * r % MOD;
        ans = r * r;
    }
    return ans;
}
/*
Bint powerb(Bint x, Bint y) {
    if(y == 0) return 1;
    if(y == 1) {
        return x;
        // return x % MOD;
    }
    Bint ans;
    if(y % 2 == 1) {
        Bint r = powerb(x,(y-1)/2);
        //ans = r * r % MOD;
        //ans = ans * x % MOD;
        ans = x * r * r;
    }
    else {
        Bint r = powerb(x,y/2);
        //ans = r * r % MOD;
        ans = r * r;
    }
    return ans;
}
*/

ll cal(ll a, ll b, ll c,ll d){
    return ((a+b+c+d)*(a+b+c+d)+a*a+b*b+c*c+d*d)/2;
}

signed main(){
    //入力の高速化用のコード
    ios::sync_with_stdio(false);
    cin.tie(nullptr);

    //入力
    ll N,M;
    cin >> N >> M;

    vll G(N+1,0);

    FOR(i,0,M){
        FOR(j,0,i){
            FOR(k,0,j){
                FOR(l,0,k){
                    ll a = cal(i,j,k,l);
                    if(a>N)continue;
                    set<ll> S;
                    S.insert(i);
                    S.insert(j);
                    S.insert(k);
                    S.insert(l);
                    if(S.size()==4)G[a]+=24;
                    else if(S.size()==2&&k!=j)G[a]+=6;
                    else if(S.size()==3)G[a]+=12;
                    else if(S.size()==2)G[a]+=4;
                    else if(S.size()==1)G[a]+=1;
                }
            }
        }
    }

    FOR(i,0,N){
        cout << G[i] << endl;
    }


    //cout << ans << endl;
    //cout << fixed << setprecision(10) << ans << endl;
  return 0;
}
0