結果

問題 No.1816 MUL-DIV Game
ユーザー gucci0512gucci0512
提出日時 2022-05-12 16:39:35
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,663 bytes
コンパイル時間 3,241 ms
コンパイル使用メモリ 229,672 KB
実行使用メモリ 8,356 KB
最終ジャッジ日時 2023-09-27 16:10:50
合計ジャッジ時間 6,489 ms
ジャッジサーバーID
(参考情報)
judge11 / judge13
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,380 KB
testcase_04 AC 1 ms
4,380 KB
testcase_05 AC 1 ms
4,376 KB
testcase_06 AC 1 ms
4,376 KB
testcase_07 AC 1 ms
4,376 KB
testcase_08 AC 1 ms
4,376 KB
testcase_09 AC 6 ms
4,376 KB
testcase_10 AC 32 ms
5,504 KB
testcase_11 AC 29 ms
5,284 KB
testcase_12 AC 21 ms
4,764 KB
testcase_13 WA -
testcase_14 WA -
testcase_15 WA -
testcase_16 WA -
testcase_17 WA -
testcase_18 WA -
testcase_19 WA -
testcase_20 WA -
testcase_21 WA -
testcase_22 WA -
testcase_23 WA -
testcase_24 WA -
testcase_25 WA -
testcase_26 AC 75 ms
8,128 KB
testcase_27 WA -
testcase_28 AC 77 ms
8,356 KB
testcase_29 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <atcoder/all>
#define rep(i,a,b) for(int i=a;i<b;i++)
#define rrep(i,b) for(int i=b-1;i>=0;i--)
#define rbit(i,a) for(int i=0;i<(1<<a);i++)
#define all(x) (x).begin(),(x).end()
#define pb(x) push_back(x);
template<class T>bool chmax(T &a, const T &b) { if (a<b) { a = b; return 1; } return 0; }
template<class T>bool chmin(T &a, const T &b) { if (b<a) { a = b; return 1; } return 0; }
typedef long long ll;
typedef long double lld;
using namespace std;
using namespace atcoder;
using mint=static_modint<1000000007>;
const ll mod=998244353;
//const ll mod=1e9+7;
int dx[4]={1,0,-1,0};
int dy[4]={0,1,0,-1};
const string zton="0123456789";
const string atoz="abcdefghijklmnopqrstuvwxyz";
const ll inf=(1ll<<60);
ll gcd(ll a,ll b){
    ll r;
    r=a%b;
    if(r==0){
        return b;
    }
    else{
        return gcd(b,r);
    }
}
typedef pair<ll,int> P;

int main(void){
    int N;cin >> N;
    multiset<ll> A;
    rep(i,0,N){
        ll a;cin >> a;
        A.insert(a);
    }
    A.insert(inf);
    rep(i,0,N-1){
        if(i%2==0){
            auto x_=A.lower_bound(0);
            A.erase(x_);
            auto y_=A.lower_bound(0);
            A.erase(y_);
            ll x=*x_;
            ll y=*y_;
            ll z=x*y;
            A.insert(z);
        }
        else if(i%2==1){
            auto x_=A.lower_bound(0);
            A.erase(x_);
            auto y_=A.lower_bound(inf);
            y_=prev(y_);
            A.erase(y_);
            ll x=*x_;
            ll y=*y_;
            ll z=(x+y-1)/y;
            A.insert(z);
        }
    }
    auto ans_=A.lower_bound(0);
    ll ans=*ans_;
    cout << ans << endl;
}
0