結果

問題 No.1682 Unfair Game
ユーザー monnumonnu
提出日時 2021-09-18 11:07:31
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 778 bytes
コンパイル時間 4,324 ms
コンパイル使用メモリ 225,768 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-09-12 20:43:26
合計ジャッジ時間 5,282 ms
ジャッジサーバーID
(参考情報)
judge15 / judge12
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 AC 2 ms
4,380 KB
testcase_02 WA -
testcase_03 WA -
testcase_04 AC 1 ms
4,380 KB
testcase_05 WA -
testcase_06 AC 2 ms
4,376 KB
testcase_07 AC 1 ms
4,380 KB
testcase_08 WA -
testcase_09 AC 1 ms
4,380 KB
testcase_10 WA -
testcase_11 AC 1 ms
4,376 KB
testcase_12 AC 2 ms
4,380 KB
testcase_13 AC 2 ms
4,376 KB
testcase_14 AC 1 ms
4,380 KB
testcase_15 AC 2 ms
4,376 KB
testcase_16 AC 2 ms
4,376 KB
testcase_17 AC 2 ms
4,376 KB
testcase_18 AC 2 ms
4,376 KB
testcase_19 WA -
testcase_20 AC 1 ms
4,376 KB
testcase_21 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using ll=long long;
using Graph=vector<vector<int>>;
#define MAX 2000005
#define MOD 1000000007
//#define MOD 998244353
#define INF 1000000000
//#define INF 1000000000000000000

int main(){
  int N;
  cin>>N;
  vector<int> P(N);
  for(int i=0;i<N;i++){
    cin>>P[i];
  }
  ll win_cnt=0;
  ll lose_cnt=0;
  for(int i=0;i<N;i++){
    if(P[i]<=50){
      ll a=2*win_cnt%MOD;
      ll b=(2*lose_cnt+1)%MOD;
      win_cnt=a;
      lose_cnt=b;
    }else{
      ll a=(win_cnt+lose_cnt+1)%MOD;
      ll b=(lose_cnt+win_cnt)%MOD;
      win_cnt=a;
      lose_cnt=b;
    }
  }
  //p(1-q)+q(1-p)>pq+(1-p)(1-q)
  //p+q-2pq>2pq-p-q+1
  //0>4pq-2p-2q+1
  //0>(2p-1)*(2q-1)
  cout<<win_cnt<<'\n';
}
0