結果

問題 No.2187 三立法和 mod 333
ユーザー t98slidert98slider
提出日時 2023-01-13 23:35:32
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 73 ms / 100 ms
コード長 677 bytes
コンパイル時間 1,372 ms
コンパイル使用メモリ 169,936 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-08-26 05:11:59
合計ジャッジ時間 4,267 ms
ジャッジサーバーID
(参考情報)
judge12 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 66 ms
4,380 KB
testcase_01 AC 39 ms
4,376 KB
testcase_02 AC 28 ms
4,376 KB
testcase_03 AC 21 ms
4,380 KB
testcase_04 AC 20 ms
4,376 KB
testcase_05 AC 29 ms
4,376 KB
testcase_06 AC 43 ms
4,380 KB
testcase_07 AC 70 ms
4,376 KB
testcase_08 AC 65 ms
4,380 KB
testcase_09 AC 69 ms
4,376 KB
testcase_10 AC 41 ms
4,376 KB
testcase_11 AC 43 ms
4,380 KB
testcase_12 AC 54 ms
4,380 KB
testcase_13 AC 46 ms
4,376 KB
testcase_14 AC 27 ms
4,380 KB
testcase_15 AC 62 ms
4,380 KB
testcase_16 AC 40 ms
4,380 KB
testcase_17 AC 43 ms
4,376 KB
testcase_18 AC 19 ms
4,380 KB
testcase_19 AC 68 ms
4,376 KB
testcase_20 AC 61 ms
4,376 KB
testcase_21 AC 73 ms
4,376 KB
testcase_22 AC 61 ms
4,376 KB
testcase_23 AC 19 ms
4,380 KB
testcase_24 AC 67 ms
4,376 KB
testcase_25 AC 18 ms
4,376 KB
testcase_26 AC 20 ms
4,380 KB
testcase_27 AC 65 ms
4,380 KB
testcase_28 AC 26 ms
4,380 KB
testcase_29 AC 61 ms
4,380 KB
testcase_30 AC 26 ms
4,380 KB
testcase_31 AC 27 ms
4,376 KB
testcase_32 AC 59 ms
4,380 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

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

int main(){
    int A;
    cin >> A;
    if(A == 333) A = 0;
    ll ans = 0, lim = 4444ll * 4444 * 4444 * 4444;
    vector<vector<ll>> tb(333);
    for(ll i = 1; i <= 4444; i++) tb[(i * i * i) % 333].push_back(i * i * i * i);
    for(int i = 0; i < 333; i++){
        for(int j = 0; j < 333; j++){
            int k = A - i - j;
            while(k < 0)k += 333;
            for(auto &&vi:tb[i]){
                for(auto &&vj:tb[j]){
                    ans += upper_bound(tb[k].begin(), tb[k].end(), lim - vi - vj) - tb[k].begin();
                }
            }
        }
    }
    cout << ans << '\n';
}
0