結果

問題 No.1331 Moving Penguin
ユーザー 👑 kmjpkmjp
提出日時 2021-01-09 01:39:08
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,271 bytes
コンパイル時間 2,291 ms
コンパイル使用メモリ 201,716 KB
実行使用メモリ 404,848 KB
最終ジャッジ日時 2024-04-28 07:45:41
合計ジャッジ時間 18,906 ms
ジャッジサーバーID
(参考情報)
judge1 / judge3
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 AC 3 ms
5,376 KB
testcase_02 AC 2 ms
5,376 KB
testcase_03 AC 3 ms
5,504 KB
testcase_04 WA -
testcase_05 AC 379 ms
404,608 KB
testcase_06 AC 342 ms
404,676 KB
testcase_07 AC 368 ms
404,648 KB
testcase_08 AC 369 ms
404,572 KB
testcase_09 AC 354 ms
404,672 KB
testcase_10 AC 371 ms
404,576 KB
testcase_11 AC 363 ms
404,692 KB
testcase_12 AC 351 ms
404,712 KB
testcase_13 AC 357 ms
404,564 KB
testcase_14 AC 363 ms
404,660 KB
testcase_15 AC 367 ms
404,744 KB
testcase_16 AC 352 ms
404,732 KB
testcase_17 AC 365 ms
404,508 KB
testcase_18 AC 365 ms
404,668 KB
testcase_19 AC 338 ms
404,524 KB
testcase_20 AC 350 ms
404,520 KB
testcase_21 AC 369 ms
404,552 KB
testcase_22 AC 350 ms
404,628 KB
testcase_23 AC 349 ms
404,524 KB
testcase_24 AC 349 ms
404,544 KB
testcase_25 AC 366 ms
404,520 KB
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 AC 361 ms
404,532 KB
testcase_30 WA -
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 AC 356 ms
404,540 KB
testcase_36 AC 365 ms
404,672 KB
testcase_37 AC 366 ms
404,700 KB
testcase_38 WA -
testcase_39 WA -
testcase_40 WA -
testcase_41 AC 363 ms
404,656 KB
testcase_42 AC 353 ms
404,744 KB
testcase_43 AC 367 ms
404,532 KB
testcase_44 AC 376 ms
404,628 KB
testcase_45 AC 360 ms
404,616 KB
testcase_46 AC 353 ms
404,708 KB
testcase_47 AC 339 ms
404,544 KB
testcase_48 AC 361 ms
404,536 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;}
//-------------------------------------------------------

int N;
int A[101010];
ll dp[101010][510];
ll S[101010];
const ll mo=1000000007;
void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	S[0]=1;
	for(i=1;i<=N;i++) {
		cin>>x;
		
		S[i]+=S[i-1];
		for(j=1;j<=500;j++) {
			S[i]+=dp[i][j];
			dp[i+j][j]+=dp[i][j];
		}
		S[i]%=mo;
		
		
		if(i==N) cout<<S[i]<<endl;
		
		if(x==1) {
			(dp[i+2][1]+=S[i])%=mo;
		}
		else if(x<=500) {
			(dp[i+x][x]+=S[i])%=mo;
		}
		else {
			for(j=i+x;j<N;j+=x) S[j]+=S[i];
		}
		
	}
	
}


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