結果

問題 No.1694 ZerOne
ユーザー 👑 kmjpkmjp
提出日時 2021-10-02 00:07:18
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 574 ms / 2,000 ms
コード長 1,359 bytes
コンパイル時間 2,101 ms
コンパイル使用メモリ 203,548 KB
実行使用メモリ 10,484 KB
最終ジャッジ日時 2023-09-26 23:51:21
合計ジャッジ時間 8,644 ms
ジャッジサーバーID
(参考情報)
judge14 / judge11
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 9 ms
10,204 KB
testcase_01 AC 8 ms
10,304 KB
testcase_02 AC 11 ms
10,156 KB
testcase_03 AC 196 ms
10,208 KB
testcase_04 AC 21 ms
10,272 KB
testcase_05 AC 61 ms
10,228 KB
testcase_06 AC 8 ms
10,360 KB
testcase_07 AC 46 ms
10,248 KB
testcase_08 AC 84 ms
10,368 KB
testcase_09 AC 222 ms
10,308 KB
testcase_10 AC 26 ms
10,312 KB
testcase_11 AC 9 ms
10,376 KB
testcase_12 AC 9 ms
10,188 KB
testcase_13 AC 113 ms
10,296 KB
testcase_14 AC 221 ms
10,192 KB
testcase_15 AC 46 ms
10,200 KB
testcase_16 AC 59 ms
10,212 KB
testcase_17 AC 16 ms
10,168 KB
testcase_18 AC 7 ms
10,164 KB
testcase_19 AC 7 ms
10,188 KB
testcase_20 AC 6 ms
10,184 KB
testcase_21 AC 574 ms
10,168 KB
testcase_22 AC 7 ms
10,192 KB
testcase_23 AC 566 ms
10,264 KB
testcase_24 AC 278 ms
10,216 KB
testcase_25 AC 275 ms
10,248 KB
testcase_26 AC 9 ms
10,292 KB
testcase_27 AC 519 ms
10,232 KB
testcase_28 AC 199 ms
10,280 KB
testcase_29 AC 105 ms
10,484 KB
testcase_30 AC 189 ms
10,252 KB
testcase_31 AC 229 ms
10,256 KB
testcase_32 AC 306 ms
10,316 KB
testcase_33 AC 284 ms
10,172 KB
権限があれば一括ダウンロードができます

ソースコード

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;}
//-------------------------------------------------------

string S;
ll from[121][3601];
ll to[121][3601];

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>S;
	vector<int> V;
	V.push_back(0);
	FORR(c,S) {
		if(c=='1') V.push_back(0);
		else V.back()++;
	}
	
	from[60][1800]=1;
	FORR(v,V) {
		ZERO(to);
		FOR(x,121) FOR(y,3601) if(from[x][y]) {
			// right
			FOR(i,61) {
				if(i>x-60+v) continue;
				to[60+i][y+i]+=from[x][y];
			}
			// left
			FOR(i,61) if(i) {
				if(x-60+v+i<0) continue;
				if(y-i<0) continue;
				to[60-i][y-i]+=from[x][y];
			}
		}
		swap(from,to);
	}
	cout<<from[60][1800]<<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