結果

問題 No.2746 Bicolor Pyramid
ユーザー Nzt3
提出日時 2024-04-13 15:23:10
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 596 bytes
コンパイル時間 2,353 ms
コンパイル使用メモリ 194,544 KB
最終ジャッジ日時 2025-02-21 01:05:09
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 2
other AC * 23 WA * 13
権限があれば一括ダウンロードができます

ソースコード

diff #

// WA
#include<bits/stdc++.h>
using namespace std;
using ull = unsigned long long;
constexpr int X=85344,sqrtX=292;

ull solve(ull v){
  ull ng=1817123,ans=0;
  while(ng-ans>1){
    ull mid=(ans+ng)/2;
    if(mid*(mid+1)*(2*mid+1)/6<=v)ans=mid;
    else ng=mid;
  }
  return ans;
}

vector<int> NG={2, 3, 6, 7, 8, 11, 12, 15, 18, 19, 22, 23, 24, 27, 28, 31, 32, 33, 43, 44, 47, 48, 60, 67, 72, 76, 92, 96, 108, 112, 128};

int main(){
  ull B,W;
  cin>>B>>W;
  if(B>W)swap(B,W);
  ull ans=0;
  ans=solve(B+W);
  for(auto i:NG){
    if(i==B){
      ans=solve(B+W-1);
    }
  }
  cout<<ans<<'\n';
}
0