結果

問題 No.814 ジジ抜き
ユーザー 👑 kmjpkmjp
提出日時 2019-04-13 01:28:12
言語 C++14
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 303 ms / 3,000 ms
コード長 1,087 bytes
コンパイル時間 1,484 ms
コンパイル使用メモリ 166,192 KB
実行使用メモリ 10,644 KB
最終ジャッジ日時 2023-10-13 09:26:09
合計ジャッジ時間 6,425 ms
ジャッジサーバーID
(参考情報)
judge13 / judge14
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
7,516 KB
testcase_01 AC 2 ms
7,668 KB
testcase_02 AC 2 ms
7,468 KB
testcase_03 AC 3 ms
7,496 KB
testcase_04 AC 303 ms
10,444 KB
testcase_05 AC 302 ms
10,644 KB
testcase_06 AC 150 ms
10,456 KB
testcase_07 AC 79 ms
8,652 KB
testcase_08 AC 127 ms
10,632 KB
testcase_09 AC 115 ms
9,396 KB
testcase_10 AC 186 ms
10,456 KB
testcase_11 AC 147 ms
10,432 KB
testcase_12 AC 87 ms
8,680 KB
testcase_13 AC 93 ms
8,624 KB
testcase_14 AC 139 ms
9,616 KB
testcase_15 AC 68 ms
8,352 KB
testcase_16 AC 61 ms
8,376 KB
testcase_17 AC 111 ms
9,748 KB
testcase_18 AC 129 ms
9,340 KB
testcase_19 AC 155 ms
10,500 KB
testcase_20 AC 88 ms
8,624 KB
testcase_21 AC 93 ms
8,820 KB
testcase_22 AC 112 ms
9,972 KB
testcase_23 AC 74 ms
8,440 KB
testcase_24 AC 97 ms
9,408 KB
testcase_25 AC 83 ms
8,868 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=-1;
	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