結果

問題 No.2982 Logic Battle
ユーザー tails
提出日時 2024-12-07 15:26:43
言語 cLay
(20241019-1)
結果
MLE  
実行時間 -
コード長 675 bytes
コンパイル時間 3,231 ms
コンパイル使用メモリ 178,936 KB
実行使用メモリ 1,584,124 KB
最終ジャッジ日時 2024-12-07 15:27:11
合計ジャッジ時間 22,953 ms
ジャッジサーバーID
(参考情報)
judge3 / judge4
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
other AC * 24 TLE * 6 MLE * 8
権限があれば一括ダウンロードができます

ソースコード

diff #

struct A{
	__int128_t d;
	ll x;
};
vector<A> s[3];
s[0].push_back({0,0});
s[1].push_back({0,0});
ll@n;
rrep(h,n){
	ll@a[3];
	vector<A> t[3];
	rep(i,3){
		vector<A> u;
		__int128_t w=0;
		rep(j,3){
			if(i!=j){
				for(auto b:s[j]){
					ll x=b.x+a[i];
					__int128_t d=b.d+x;
					u.push_back({d,x=x==0?0:x-1});
					w=max(w,d+__int128_t(x+x-h+1)*h/2);
				}
			}
		}
		for(auto b:u){
			long y=min(b.x,h);
			if(b.d+__int128_t(b.x*2-y+1)*y/2>=w){
				t[i].push_back(b);
			}
		}
	}
	rep(i,3){
		s[i]=t[i];
	}
}
__int128_t z=0;
rep(i,3){
	for(auto b:s[i]){
		z=max(z,b.d);
	}
}
if(z>=10d18){
	printf("%lld%018lld",(ll)(z/1d18),(ll)(z%1d18));
}else{
	printf("%lld",(ll)z);
}
0