結果
問題 | No.2510 Six Cube Sum Counting |
ユーザー | ゆにぽけ |
提出日時 | 2023-10-21 00:13:31 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
AC
|
実行時間 | 896 ms / 4,000 ms |
コード長 | 1,488 bytes |
コンパイル時間 | 1,786 ms |
コンパイル使用メモリ | 146,140 KB |
実行使用メモリ | 149,312 KB |
最終ジャッジ日時 | 2023-10-21 00:13:57 |
合計ジャッジ時間 | 25,161 ms |
ジャッジサーバーID (参考情報) |
judge13 / judge10 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 624 ms
147,140 KB |
testcase_01 | AC | 620 ms
147,140 KB |
testcase_02 | AC | 753 ms
148,256 KB |
testcase_03 | AC | 629 ms
147,140 KB |
testcase_04 | AC | 593 ms
147,140 KB |
testcase_05 | AC | 638 ms
147,140 KB |
testcase_06 | AC | 612 ms
147,140 KB |
testcase_07 | AC | 620 ms
147,140 KB |
testcase_08 | AC | 611 ms
147,140 KB |
testcase_09 | AC | 626 ms
147,140 KB |
testcase_10 | AC | 596 ms
147,140 KB |
testcase_11 | AC | 624 ms
147,140 KB |
testcase_12 | AC | 597 ms
147,140 KB |
testcase_13 | AC | 627 ms
147,140 KB |
testcase_14 | AC | 595 ms
147,140 KB |
testcase_15 | AC | 621 ms
147,140 KB |
testcase_16 | AC | 661 ms
147,140 KB |
testcase_17 | AC | 613 ms
147,140 KB |
testcase_18 | AC | 654 ms
147,140 KB |
testcase_19 | AC | 678 ms
147,140 KB |
testcase_20 | AC | 804 ms
148,256 KB |
testcase_21 | AC | 832 ms
148,256 KB |
testcase_22 | AC | 896 ms
149,312 KB |
testcase_23 | AC | 836 ms
148,520 KB |
testcase_24 | AC | 791 ms
148,256 KB |
testcase_25 | AC | 653 ms
147,140 KB |
testcase_26 | AC | 690 ms
147,140 KB |
testcase_27 | AC | 719 ms
147,728 KB |
testcase_28 | AC | 612 ms
147,140 KB |
testcase_29 | AC | 761 ms
148,520 KB |
ソースコード
#include<iostream> #include<vector> #include<algorithm> #include<cstring> #include<cassert> #include<cmath> #include<ctime> #include<iomanip> #include<numeric> #include<stack> #include<queue> #include<map> #include<unordered_map> #include<set> #include<unordered_set> #include<bitset> #include<random> using namespace std; const int N = 300; void solve() { int X;cin >> X; vector<pair<int,pair<int,pair<int,int>>>> A; for(int i = 0;i <= N;i++)for(int j = i;j <= N;j++)for(int k = j;k <= N;k++) A.push_back(make_pair(i*i*i+j*j*j+k*k*k,make_pair(i,make_pair(j,k)))); sort(A.begin(),A.end()); vector<pair<int,pair<int,pair<int,int>>>> B(A.rbegin(),A.rend()); long long ans = 0; int bi = 0; unordered_set<long long> S; for(int i = 0;i < (int)A.size();i++) { while(bi < (int)B.size() && A[i].first+B[bi].first > X) bi++; if(bi < (int)B.size() && A[i].first+B[bi].first == X) { vector<int> v; v.push_back(A[i].second.first); v.push_back(A[i].second.second.first); v.push_back(A[i].second.second.second); v.push_back(B[bi].second.first); v.push_back(B[bi].second.second.first); v.push_back(B[bi].second.second.second); sort(v.begin(),v.end()); long long val = 0; for(int j = 0;j < 6;j++) val = val*(N+1) + v[j]; if(S.count(val)); else ans++,S.insert(val); //cout << A[i] << " " << B[bi] << endl; } } cout << ans << endl; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int tt = 1; //cin >> tt; while(tt--) solve(); }