結果

問題 No.954 Result
ユーザー ysystem7
提出日時 2020-04-18 12:07:29
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
WA  
実行時間 -
コード長 1,306 bytes
コンパイル時間 3,598 ms
コンパイル使用メモリ 214,000 KB
最終ジャッジ日時 2025-01-09 21:08:51
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 6 WA * 1
other AC * 25 WA * 4
権限があれば一括ダウンロードができます

ソースコード

diff #

#pragma GCC optimize("Ofast")
#include <bits/stdc++.h>
#define rep(i,n) for(int i=0;i<n;i++)
#define cinf(n,x) for(int i=0;i<(n);i++)cin>>x[i];
#define ft first
#define sc second
#define pb push_back
#define lb lower_bound
#define ub upper_bound
#define all(v) (v).begin(),(v).end()
#define mod 1000000007
#define FS fixed<<setprecision(15)
using namespace std;
typedef long long ll;
template<class T> using V=vector<T>;
using Graph = vector<vector<int>>;
using P=pair<ll,ll>;
typedef unsigned long long ull;
typedef long double ldouble;
template<class T> inline bool chmin(T& a, T b) { if (a > b) { a = b; return true; } return false; }
template<class T> inline bool chmax(T& a, T b) { if (a < b) { a = b; return true; } return false; }

const ll INF=1e18;

int main(){
    cin.tie(0);ios::sync_with_stdio(false);
    V<ll> a(5);
    rep(i,5) cin>>a[i];
    reverse(all(a));
    V<ll> b(500);
    b[0]=1;
    b[1]=1;
    for(int i=2;i<500;i++){
        b[i]=b[i-1]+b[i-2];
    }
    sort(all(b));
    int m=0;
    if(b[m]==1&&a[0]<a[1]) m++;
    else m=lb(all(b),a[0])-b.begin();
    //cout<<b[m]<<endl;
    int k=0;
    int ans=0;
    while(k<5){
        if(b[m]==a[k]){
            chmax(ans,k+1);
            //cout<<-1<<endl;
        }else break;
        m++;
        k++;
    }
    cout<<ans<<endl;
}
0