結果

問題 No.437 cwwゲーム
ユーザー albicillaalbicilla
提出日時 2016-11-03 14:07:33
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 961 bytes
コンパイル時間 1,144 ms
コンパイル使用メモリ 144,424 KB
実行使用メモリ 4,508 KB
最終ジャッジ日時 2023-08-16 13:20:05
合計ジャッジ時間 2,771 ms
ジャッジサーバーID
(参考情報)
judge13 / judge15
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,376 KB
testcase_01 AC 1 ms
4,380 KB
testcase_02 AC 2 ms
4,376 KB
testcase_03 AC 1 ms
4,376 KB
testcase_04 AC 1 ms
4,376 KB
testcase_05 AC 2 ms
4,376 KB
testcase_06 AC 2 ms
4,380 KB
testcase_07 WA -
testcase_08 AC 1 ms
4,376 KB
testcase_09 WA -
testcase_10 AC 2 ms
4,376 KB
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 WA -
testcase_15 WA -
testcase_16 AC 2 ms
4,380 KB
testcase_17 AC 1 ms
4,376 KB
testcase_18 AC 2 ms
4,380 KB
testcase_19 AC 2 ms
4,380 KB
testcase_20 AC 1 ms
4,376 KB
testcase_21 AC 1 ms
4,376 KB
testcase_22 AC 1 ms
4,376 KB
testcase_23 WA -
testcase_24 AC 1 ms
4,380 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 AC 1 ms
4,376 KB
testcase_28 AC 1 ms
4,380 KB
testcase_29 AC 1 ms
4,376 KB
testcase_30 AC 1 ms
4,380 KB
testcase_31 AC 1 ms
4,376 KB
testcase_32 AC 1 ms
4,380 KB
testcase_33 AC 1 ms
4,376 KB
testcase_34 AC 1 ms
4,376 KB
testcase_35 AC 1 ms
4,376 KB
testcase_36 AC 2 ms
4,380 KB
testcase_37 AC 2 ms
4,376 KB
testcase_38 AC 1 ms
4,376 KB
testcase_39 AC 1 ms
4,380 KB
testcase_40 AC 1 ms
4,380 KB
testcase_41 AC 1 ms
4,376 KB
testcase_42 WA -
testcase_43 WA -
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;

string s;
int ans;
int a[15];
int main(){
  cin>>s;
  for(int i=0;i<11;i++)a[i]=0;

  for(int i=s.size()-1;i>=0;i--){
    int p=(s[i]-'0');
    a[p]++;
      if(a[p]>=2){
      //  cout<<"i="<<i<<" "<<a[p]<<endl;
      //  cout<<"i="<<i<<endl;
        a[p]=0;
        int mx=0,memo=-1;
        if(i==0)break;
        int a_memo=p;
        for(int j=i;j>=0;j--){
          int temp=mx;
          p=(s[j]-'0');
        //  cout<<p<<endl;
          if(p!=a_memo){
            mx=max(p,mx);
            if(mx!=temp){
              memo=j;
            }
          }
        }
        if(memo!=-1){
          int t=(s[memo]-'0');
        //  cout<<"memo="<<memo<<endl;
          //cout<<"t="<<t<<" i="<<i<<" s[i]"<<s[i]<<endl;

        //  cout<<"s="<<s<<endl;

          ans+=t*100+(s[i]-'0')*11;
          //cout<<ans<<endl;
          s.erase(s.begin()+memo);
          i--;
        }
      }
  }
  cout<<ans<<endl;
}
0