結果

問題 No.258 回転寿司(2)
ユーザー takubokudoritakubokudori
提出日時 2017-09-20 13:34:06
言語 C++11
(gcc 11.4.0)
結果
WA  
実行時間 -
コード長 2,136 bytes
コンパイル時間 1,440 ms
コンパイル使用メモリ 162,224 KB
実行使用メモリ 6,948 KB
最終ジャッジ日時 2024-04-25 21:09:54
合計ジャッジ時間 5,023 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 WA -
testcase_01 WA -
testcase_02 WA -
testcase_03 WA -
testcase_04 WA -
testcase_05 WA -
testcase_06 WA -
testcase_07 AC 1 ms
6,940 KB
testcase_08 WA -
testcase_09 WA -
testcase_10 WA -
testcase_11 WA -
testcase_12 WA -
testcase_13 WA -
testcase_14 WA -
testcase_15 AC 2 ms
6,940 KB
testcase_16 WA -
testcase_17 WA -
testcase_18 AC 1 ms
6,940 KB
testcase_19 WA -
testcase_20 AC 2 ms
6,940 KB
testcase_21 WA -
testcase_22 AC 1 ms
6,940 KB
testcase_23 WA -
testcase_24 AC 1 ms
6,940 KB
testcase_25 WA -
testcase_26 WA -
testcase_27 WA -
testcase_28 WA -
testcase_29 WA -
testcase_30 AC 1 ms
6,940 KB
testcase_31 WA -
testcase_32 WA -
testcase_33 WA -
testcase_34 WA -
testcase_35 WA -
testcase_36 AC 2 ms
6,944 KB
testcase_37 WA -
testcase_38 WA -
testcase_39 AC 2 ms
6,940 KB
testcase_40 WA -
testcase_41 WA -
testcase_42 AC 1 ms
6,940 KB
testcase_43 WA -
testcase_44 WA -
testcase_45 WA -
testcase_46 WA -
testcase_47 WA -
testcase_48 WA -
testcase_49 AC 1 ms
6,940 KB
testcase_50 WA -
testcase_51 WA -
testcase_52 WA -
testcase_53 AC 1 ms
6,940 KB
testcase_54 WA -
testcase_55 WA -
testcase_56 AC 1 ms
6,944 KB
testcase_57 AC 2 ms
6,940 KB
testcase_58 WA -
testcase_59 WA -
testcase_60 WA -
testcase_61 WA -
testcase_62 AC 2 ms
6,944 KB
testcase_63 WA -
testcase_64 WA -
testcase_65 WA -
testcase_66 AC 1 ms
6,940 KB
testcase_67 WA -
testcase_68 WA -
testcase_69 AC 2 ms
6,944 KB
testcase_70 AC 1 ms
6,940 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>

#define MOD 1000000007
#define INF (1<<30)
#define INFL (1<<62)
#define pe(str) return cout<<(str)<<endl,0
#define px(str) cout<<(str)<<endl,exit(0)
#define accu(ac,v) cout<<setprecision(ac)<<v<<endl
#define bpc(a) __builtin_popcount(a)
#define pr(str) cout<<(str)<<endl
#define prpr(str) cout<<str<<endl
#define db(str) cerr<<"debug:"<<(str)<<endl
#define dbdb(str) cerr<<"debugs:"<<str<<endl
#define re(i,n) for(int i=0;i<(n);i++)
#define rre(i,n) for(int i=(n);i>=0;i--)
#define rep(i,a,b) for(int i=(a);i<(b);i++)
#define rrep(i,a,b) for(int i=(b);i>=(a);i--)
#define bw(a,b,c) (((a)<=(b))&&((b)<=(c)))
#define hello cout<<"hello"<<endl
#define spre(a) setprecision(a)
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define IF(C,T,F) ((C)?(T):(F))
#define max3(a,b,c) max((a),max((b),(c)))
#define min3(a,b,c) min((a),min((b),(c)))
#define max4(a,b,c,d) max((a),max((b),max((c),(d))))
#define min4(a,b,c,d) min((a),min((b),min((c),(d))))
#define enl cout<<endl
#define declare(t,n) t n;cin>>n
#define EPS 1e-6
#define EPSIN(a,b) ((b)-EPS<=(a)&&(a)<=(b)+EPS)

using namespace std;

typedef long long ll;
typedef unsigned long long ull;
typedef long double ld;
typedef pair<int,int> pii;
typedef complex<int> point;

template<class InputIterator>
void dump(InputIterator first,InputIterator last,char delim=' '){
	for(InputIterator it=first;it!=last;it++){
		if(it!=first)cout<<delim;
		cout<<*it;
	}
}

ull p(ull x,ull y){
	if(y==0) return 1;
	ull A=p(x,y/2)%MOD;
	return (y&1?((A*A)%MOD*x)%MOD: (A*A)%MOD);
	// return (y&1?((A*A)*x):(A*A));
}

template<class T>
void swp(T &a,T &b){
	T t=a; a=b; b=t;
}

int main(void){
	int dp[1001][2];
	std::vector<int> v;
	int n;
	cin>>n;
	int a[n];
	re(i,n)cin>>a[i];
	dp[0][0]=dp[0][1]=0;
	dp[1][0]=0;
	dp[1][1]=a[0];
	// dp[2][0]=a[0];
	// dp[2][1]=a[1];
	// dp[3][0]=max(a[0],a[1]);
	// dp[3][1]=a[0]+a[2];
	rep(i,1,n+1){
		dp[i][0]=max(dp[i-1][0],dp[i-1][1]);
		dp[i][1]=dp[i-1][0]+a[i-1];
	}
	pr(max(dp[n][0],dp[n][1]));
	for(int i=n;i>1;i--){
		if(dp[i][0]<dp[i][1])v.push_back(i),i--;
	}
	dump(rall(v));
	cout<<endl;

	return 0;
}
0