結果
問題 |
No.864 四方演算
|
ユーザー |
![]() |
提出日時 | 2024-01-19 22:45:59 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 790 bytes |
コンパイル時間 | 3,944 ms |
コンパイル使用メモリ | 266,880 KB |
実行使用メモリ | 10,752 KB |
最終ジャッジ日時 | 2024-09-28 04:54:49 |
合計ジャッジ時間 | 6,556 ms |
ジャッジサーバーID (参考情報) |
judge3 / judge2 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | -- * 3 |
other | WA * 1 TLE * 1 -- * 25 |
ソースコード
#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); }