結果

問題 No.814 ジジ抜き
ユーザー 👑 kmjpkmjp
提出日時 2019-04-13 01:27:25
言語 C++14
(gcc 13.2.0 + boost 1.83.0)
結果
WA  
実行時間 -
コード長 1,086 bytes
コンパイル時間 1,429 ms
コンパイル使用メモリ 165,124 KB
実行使用メモリ 10,588 KB
最終ジャッジ日時 2023-10-13 09:26:02
合計ジャッジ時間 6,592 ms
ジャッジサーバーID
(参考情報)
judge12 / judge15
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,588 KB
testcase_01 WA -
testcase_02 AC 2 ms
7,444 KB
testcase_03 AC 3 ms
7,600 KB
testcase_04 AC 286 ms
10,588 KB
testcase_05 AC 278 ms
10,464 KB
testcase_06 AC 138 ms
10,388 KB
testcase_07 AC 70 ms
8,652 KB
testcase_08 AC 121 ms
10,532 KB
testcase_09 AC 106 ms
9,408 KB
testcase_10 AC 181 ms
10,328 KB
testcase_11 AC 137 ms
10,512 KB
testcase_12 AC 79 ms
8,796 KB
testcase_13 AC 84 ms
8,620 KB
testcase_14 AC 126 ms
9,592 KB
testcase_15 AC 62 ms
8,464 KB
testcase_16 AC 55 ms
8,328 KB
testcase_17 AC 104 ms
9,712 KB
testcase_18 AC 123 ms
9,252 KB
testcase_19 AC 145 ms
10,416 KB
testcase_20 AC 79 ms
8,632 KB
testcase_21 AC 86 ms
8,920 KB
testcase_22 AC 104 ms
9,988 KB
testcase_23 AC 66 ms
8,540 KB
testcase_24 AC 85 ms
9,560 KB
testcase_25 AC 73 ms
8,772 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
typedef signed long long ll;

#undef _P
#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 ITR(x,c) for(__typeof(c.begin()) x=c.begin();x!=c.end();x++)
#define ALL(a) (a.begin()),(a.end())
#define ZERO(a) memset(a,0,sizeof(a))
#define MINUS(a) memset(a,0xff,sizeof(a))
//-------------------------------------------------------

int N;
ll K[303030],L[303030],D[303030];

ll hoge(ll v) {
	ll tot=0;
	int i;
	FOR(i,N) if(v>=L[i]) {
		if(L[i]+(K[i]-1)*D[i]<=v) {
			tot+=K[i];
		}
		else {
			tot+=1+(v-L[i])/D[i];
		}
	}
	return tot;
}

void solve() {
	int i,j,k,l,r,x,y; string s;
	
	cin>>N;
	FOR(i,N) {
		cin>>K[i]>>L[i]>>D[i];
		D[i]=1LL<<D[i];
	}
	
	ll ma=0;
	for(i=60;i>=0;i--) if(hoge(ma+(1LL<<i))%2==0) ma+=1LL<<i;
	cout<<ma+1<<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