結果

問題 No.864 四方演算
ユーザー mofuuni1129mofuuni1129
提出日時 2024-01-19 22:45:59
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 790 bytes
コンパイル時間 4,093 ms
コンパイル使用メモリ 268,096 KB
実行使用メモリ 13,480 KB
最終ジャッジ日時 2024-01-19 22:46:06
合計ジャッジ時間 6,608 ms
ジャッジサーバーID
(参考情報)
judge15 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 TLE -
testcase_02 -- -
testcase_03 -- -
testcase_04 -- -
testcase_05 -- -
testcase_06 -- -
testcase_07 -- -
testcase_08 -- -
testcase_09 -- -
testcase_10 -- -
testcase_11 -- -
testcase_12 -- -
testcase_13 -- -
testcase_14 -- -
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 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC target("avx2")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#include <bits/stdc++.h>
using namespace std;
using ll=long long;
using ull=unsigned long long;
using pii=pair<int,int>;
using pll=pair<ll,ll>;
using graph=vector<ll>;
#define cY cout <<"Yes\n"
#define cN cout <<"No\n"
#define csp cout <<" "
#define out(a) cout <<(a)
#define cout(a) cout <<(a) <<"\n"

vector<pll> div(ll x){
    vector<pll> r;
    for(int i=1; i*i<=x; i++){
        if(x%i==0)r.push_back(make_pair(i,x/i));
    }
    return r;
}
int main(){
    ll n,k,ans=0;;
    cin >>n >>k;
    vector<pll> a=div(k);
    for(auto i:a){
        ll A=min({n,i.first-1,max(2*n-i.first+1,0LL)});
        ll B=min({n,i.second-1,max(2*n-i.second+1,0LL)});
        ans+=2*A*B;
    }
    cout(ans);
}
0