結果

問題 No.1417 100の倍数かつ正整数(2)
ユーザー たたき@競プロたたき@競プロ
提出日時 2023-09-05 20:04:45
言語 C++23
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,247 bytes
コンパイル時間 6,309 ms
コンパイル使用メモリ 310,640 KB
実行使用メモリ 5,316 KB
最終ジャッジ日時 2023-09-05 20:04:56
合計ジャッジ時間 8,860 ms
ジャッジサーバーID
(参考情報)
judge11 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 1 ms
4,380 KB
testcase_01 WA -
testcase_02 AC 1 ms
4,380 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 WA -
testcase_05 RE -
testcase_06 WA -
testcase_07 RE -
testcase_08 RE -
testcase_09 RE -
testcase_10 WA -
testcase_11 AC 2 ms
4,376 KB
testcase_12 WA -
testcase_13 WA -
testcase_14 AC 2 ms
4,376 KB
testcase_15 RE -
testcase_16 WA -
testcase_17 WA -
testcase_18 RE -
testcase_19 RE -
testcase_20 WA -
testcase_21 WA -
testcase_22 RE -
testcase_23 RE -
testcase_24 AC 2 ms
4,376 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 RE -
testcase_28 WA -
testcase_29 RE -
testcase_30 RE -
testcase_31 AC 2 ms
4,380 KB
testcase_32 WA -
testcase_33 WA -
testcase_34 RE -
testcase_35 WA -
testcase_36 WA -
testcase_37 WA -
testcase_38 AC 6 ms
4,376 KB
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: 関数 ‘int main()’ 内:
main.cpp:49:11: 警告: ‘tb’ may be used uninitialized [-Wmaybe-uninitialized]
   49 |   if(ta==2&&tb==2&&ok)ans++;
      |      ~~~~~^~~~~~~
main.cpp:19:34: 備考: ‘tb’ はここで定義されています
   19 |   vc dp(3,vc<mint>(3,0)); int ta,tb;bool ok=true,fir=true;
      |                                  ^~
main.cpp:49:3: 警告: ‘ta’ may be used uninitialized [-Wmaybe-uninitialized]
   49 |   if(ta==2&&tb==2&&ok)ans++;
      |   ^~
main.cpp:19:31: 備考: ‘ta’ はここで定義されています
   19 |   vc dp(3,vc<mint>(3,0)); int ta,tb;bool ok=true,fir=true;
      |                               ^~

ソースコード

diff #

#include<bits/stdc++.h>
using namespace std;
#include <atcoder/all>
using namespace atcoder;
using mint=modint1000000007;
using ll=long long;
using pp=pair<ll,ll>;
#define sr string 
#define vc vector
#define fi first
#define se second
#define rep(i,n) for(ll i=0;i<(ll)n;i++)
#define pb push_back
#define all(v) v.begin(),v.end()
#define pque priority_queue
#define bpc(a) __builtin_popcount(a)
int main(){
  sr s;cin>>s;
  vc dp(3,vc<mint>(3,0)); int ta,tb;bool ok=true,fir=true;
  for(char c:s){
    int x=c-'0';
    vc pre(3,vc<mint>(3,0)); swap(pre,dp);
    if(x==0)ok=false;
   
    if(!fir){
      dp[0][0]+=4;
      dp[1][0]+=2; dp[0][1]++;
      dp[2][0]+=2;
    }
    if(ok)for(int i=1;i<x;i++){
      int a=ta,b=tb;
      if(i==2||i==6)a++; if(i==5)b++; if(i==4||i==8)a+=2;
      a=min(a,2); b=min(b,2);
      dp[a][b]++;
    }
    rep(i,3)rep(j,3){
      for(int t=1;t<10;t++){
        int ni=i,nj=j;
        if(t==2||t==6)ni++; if(t==5)nj++; if(t==4||t==8)ni+=2;
        ni=min(ni,2); nj=min(nj,2);
        dp[ni][nj]+=pre[i][j];
      }
    }
    fir=false;
    if(x==2||x==6)ta++; if(x==5)tb++; if(x==4||x==8)ta+=2;
    ta=min(ta,2); tb=min(tb,2);
  }
  mint ans=dp[2][2];
  if(ta==2&&tb==2&&ok)ans++;
  cout<<ans.val();
}
      
  
0