結果
問題 | No.1654 Binary Compression |
ユーザー | 👑 kmjp |
提出日時 | 2021-08-21 00:25:16 |
言語 | C++17 (gcc 12.3.0 + boost 1.83.0) |
結果 |
WA
|
実行時間 | - |
コード長 | 1,638 bytes |
コンパイル時間 | 2,525 ms |
コンパイル使用メモリ | 204,320 KB |
実行使用メモリ | 42,704 KB |
最終ジャッジ日時 | 2024-04-22 09:47:16 |
合計ジャッジ時間 | 8,939 ms |
ジャッジサーバーID (参考情報) |
judge1 / judge5 |
(要ログイン)
テストケース
テストケース表示入力 | 結果 | 実行時間 実行使用メモリ |
---|---|---|
testcase_00 | AC | 2 ms
6,812 KB |
testcase_01 | AC | 2 ms
6,948 KB |
testcase_02 | AC | 2 ms
6,944 KB |
testcase_03 | AC | 2 ms
6,940 KB |
testcase_04 | AC | 3 ms
6,944 KB |
testcase_05 | AC | 2 ms
6,944 KB |
testcase_06 | AC | 2 ms
6,944 KB |
testcase_07 | WA | - |
testcase_08 | AC | 3 ms
6,940 KB |
testcase_09 | AC | 2 ms
6,940 KB |
testcase_10 | WA | - |
testcase_11 | AC | 126 ms
40,300 KB |
testcase_12 | WA | - |
testcase_13 | WA | - |
testcase_14 | WA | - |
testcase_15 | WA | - |
testcase_16 | WA | - |
testcase_17 | WA | - |
testcase_18 | AC | 130 ms
41,776 KB |
testcase_19 | AC | 129 ms
41,456 KB |
testcase_20 | AC | 127 ms
41,816 KB |
testcase_21 | WA | - |
testcase_22 | AC | 128 ms
41,628 KB |
testcase_23 | WA | - |
testcase_24 | AC | 26 ms
22,896 KB |
testcase_25 | WA | - |
testcase_26 | AC | 25 ms
23,020 KB |
testcase_27 | AC | 82 ms
38,000 KB |
testcase_28 | AC | 99 ms
41,448 KB |
testcase_29 | WA | - |
testcase_30 | WA | - |
testcase_31 | WA | - |
testcase_32 | WA | - |
testcase_33 | WA | - |
testcase_34 | WA | - |
testcase_35 | WA | - |
testcase_36 | WA | - |
testcase_37 | AC | 24 ms
24,944 KB |
testcase_38 | WA | - |
testcase_39 | AC | 151 ms
41,580 KB |
testcase_40 | WA | - |
testcase_41 | AC | 157 ms
41,448 KB |
testcase_42 | AC | 17 ms
9,104 KB |
testcase_43 | AC | 22 ms
8,276 KB |
testcase_44 | AC | 156 ms
42,296 KB |
testcase_45 | AC | 157 ms
41,452 KB |
testcase_46 | AC | 11 ms
7,860 KB |
testcase_47 | AC | 2 ms
6,944 KB |
testcase_48 | AC | 2 ms
6,940 KB |
testcase_49 | WA | - |
testcase_50 | WA | - |
testcase_51 | AC | 73 ms
27,100 KB |
testcase_52 | WA | - |
ソースコード
#include <bits/stdc++.h> using namespace std; typedef signed long long ll; #define _P(...) (void)printf(__VA_ARGS__) #define FOR(x,to) for(x=0;x<(to);x++) #define FORR(x,arr) for(auto& x:arr) #define FORR2(x,y,arr) for(auto& [x,y]:arr) #define ALL(a) (a.begin()),(a.end()) #define ZERO(a) memset(a,0,sizeof(a)) #define MINUS(a) memset(a,0xff,sizeof(a)) 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(a>b){a=b;return 1;}return 0;} //------------------------------------------------------- int N; string S; const ll mo=924844033; int len0[3030303]; ll dp[3030303]; void solve() { int i,j,k,l,r,x,y; string s; cin>>S; if(count(ALL(S),'1')==0) { cout<<S.size()<<endl; return; } int lef=1; while(S.back()=='0') { S.pop_back(); lef++; } N=S.size(); int cur=0; FOR(i,N) { if(S[i]=='0') { cur++; } else { len0[i]=cur+1; cur=0; } } map<int,ll> tar; ll sum=lef; for(i=N-1;i>=0;i--) if(S[i]=='1') { dp[i]=sum; int pre=0; while(tar.size()) { x=tar.begin()->first; y=tar.begin()->second; if(x<=len0[i]) { (sum-=1LL*(x-pre)*y)%=mo; pre=x; tar.erase(tar.begin()); } else { (sum-=1LL*(len0[i]-pre)*y)%=mo; break; } } (sum+=len0[i]*dp[i])%=mo; tar[len0[i]]=dp[i]; } cout<<(tar.begin()->first)*(ll)(tar.begin()->second)%mo<<endl; } int main(int argc,char** argv){ string s;int i; if(argc==1) ios::sync_with_stdio(false), cin.tie(0); FOR(i,argc-1) s+=argv[i+1],s+='\n'; FOR(i,s.size()) ungetc(s[s.size()-1-i],stdin); cout.tie(0); solve(); return 0; }