結果

問題 No.1654 Binary Compression
ユーザー 👑 kmjpkmjp
提出日時 2021-08-21 00:17:48
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
TLE  
実行時間 -
コード長 1,485 bytes
コンパイル時間 2,483 ms
コンパイル使用メモリ 204,600 KB
実行使用メモリ 41,580 KB
最終ジャッジ日時 2024-04-22 09:40:38
合計ジャッジ時間 9,681 ms
ジャッジサーバーID
(参考情報)
judge5 / judge2
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
10,624 KB
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 3 ms
5,376 KB
testcase_03 AC 4 ms
5,376 KB
testcase_04 AC 3 ms
5,376 KB
testcase_05 AC 3 ms
5,376 KB
testcase_06 AC 3 ms
5,376 KB
testcase_07 AC 3 ms
5,376 KB
testcase_08 AC 3 ms
5,376 KB
testcase_09 AC 3 ms
5,376 KB
testcase_10 AC 187 ms
40,044 KB
testcase_11 AC 159 ms
40,428 KB
testcase_12 AC 162 ms
41,320 KB
testcase_13 AC 156 ms
41,196 KB
testcase_14 AC 153 ms
40,428 KB
testcase_15 AC 153 ms
41,064 KB
testcase_16 AC 36 ms
41,456 KB
testcase_17 AC 37 ms
41,580 KB
testcase_18 AC 156 ms
41,576 KB
testcase_19 AC 157 ms
41,576 KB
testcase_20 AC 157 ms
41,448 KB
testcase_21 AC 155 ms
41,452 KB
testcase_22 AC 155 ms
41,448 KB
testcase_23 AC 46 ms
22,896 KB
testcase_24 AC 69 ms
22,896 KB
testcase_25 AC 67 ms
23,020 KB
testcase_26 AC 68 ms
23,016 KB
testcase_27 TLE -
testcase_28 -- -
testcase_29 -- -
testcase_30 -- -
testcase_31 -- -
testcase_32 -- -
testcase_33 -- -
testcase_34 -- -
testcase_35 -- -
testcase_36 -- -
testcase_37 -- -
testcase_38 -- -
testcase_39 -- -
testcase_40 -- -
testcase_41 -- -
testcase_42 -- -
testcase_43 -- -
testcase_44 -- -
testcase_45 -- -
testcase_46 -- -
testcase_47 -- -
testcase_48 -- -
testcase_49 -- -
testcase_50 -- -
testcase_51 -- -
testcase_52 -- -
権限があれば一括ダウンロードができます

ソースコード

diff #

#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;
			cur=0;
		}
	}
	map<int,ll> tar;
	for(i=N-1;i>=0;i--) if(S[i]=='1') {
		int cur=-1;
		ll pat=lef;
		FORR2(a,b,tar) {
			(pat+=(a-cur)*b)%=mo;
			cur=a;
		}
		tar[len0[i]]=dp[i]=pat;
		while(tar.begin()->first<len0[i]) tar.erase(tar.begin());
	}
	
	cout<<(tar.begin()->first+1)*(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;
}
0