結果
| 問題 | No.1318 ABCD quadruplets |
| コンテスト | |
| ユーザー |
vjudge1
|
| 提出日時 | 2026-02-11 02:51:42 |
| 言語 | C++23 (gcc 15.2.0 + boost 1.89.0) |
| 結果 |
TLE
|
| 実行時間 | - |
| コード長 | 1,601 bytes |
| 記録 | |
| コンパイル時間 | 3,083 ms |
| コンパイル使用メモリ | 340,388 KB |
| 実行使用メモリ | 12,192 KB |
| 最終ジャッジ日時 | 2026-02-11 02:51:50 |
| 合計ジャッジ時間 | 7,694 ms |
|
ジャッジサーバーID (参考情報) |
judge5 / judge1 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 11 TLE * 1 -- * 18 |
ソースコード
#include <bits/stdc++.h>
// #ifndef ONLINE_JUDGE
// #include "debug/debug_template.cpp"
// #else
// #define debug(...)
// #define debugArr(...)
// #endif
#define ll long long
#define nl "\n"
#define vi vector<int>
#define vvi vector<vector<int>>
#define int long long
#define pii pair<int,int>
#define double long double
#define pb push_back
#define here cout<<"HERE"<<nl;
#define forn(i,a,n) for(int i = a; i < n; i++)
#define print(a) for(auto& e : a) cout << e << " "; cout << nl;
#define all(a) a.begin(),a.end()
#define MOD(a,b) ((a%b)+b)%b
#define yesno(b) cout << ((b)? "YES\n" : "NO\n")
template<typename T> using min_heap = std::priority_queue<T, std::vector<T>, std::greater<T>>;
using namespace std;
// a ^2+ab+ac+ad+b^2 +bc+bd+c^2+cd+d ^2=n
// (a2+ab+b2)+(c2+cd+d2)+(a+b)(c+d)
void solve(){
int n, m;
cin>>n>>m;
vi ans(n + 1);
forn(a,0,m+1){
forn(b,0 ,a+ 1){
forn(c,0,b+1){
forn(d,0,c+1){
int v=a*a+a*b+b*b+c*c+c*d+d*d+(a+b)*(c+d);
set<int> s={a,b,c,d};
if(v > n)break;
if (a == d) ans[v] += 1;
else if (a == b && b == c) ans[v] += 4;
else if (b == c && c == d) ans[v] += 4;
else if (a == b && c == d) ans[v] += 6;
else if (a == b || b == c || c == d) ans[v] += 12;
else ans[v] += 24;
}
}
}
}
forn(i, 0 ,n + 1)cout << ans[i] << nl;
}
signed main() {
ios::sync_with_stdio(0);
cin.tie(0);
cout.tie(0);
int t = 1;
//cin >> t;
while (t--){
solve();
}
return 0;
}
vjudge1