結果

問題 No.1682 Unfair Game
ユーザー monnumonnu
提出日時 2021-09-18 11:12:34
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 2 ms / 2,000 ms
コード長 929 bytes
コンパイル時間 4,168 ms
コンパイル使用メモリ 225,684 KB
実行使用メモリ 4,380 KB
最終ジャッジ日時 2023-09-12 20:45:37
合計ジャッジ時間 5,099 ms
ジャッジサーバーID
(参考情報)
judge12 / judge13
このコードへのチャレンジ(β)

テストケース

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

ソースコード

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;
  ll draw_cnt=0;
  for(int i=0;i<N;i++){
    if(P[i]>50){
      ll a=(win_cnt+lose_cnt+1)%MOD;
      ll b=(lose_cnt+win_cnt)%MOD;
      win_cnt=a;
      lose_cnt=b;
      draw_cnt=2*draw_cnt%MOD;
    }else if(P[i]<50){
      ll a=2*win_cnt%MOD;
      ll b=(2*lose_cnt+1)%MOD;
      win_cnt=a;
      lose_cnt=b;
      draw_cnt=2*draw_cnt%MOD;
    }else{
      draw_cnt=(draw_cnt+win_cnt+lose_cnt+1)%MOD;
    }
  }
  //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