結果

問題 No.814 ジジ抜き
ユーザー kotatsugame
提出日時 2020-03-27 04:27:23
言語 C++14
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 405 ms / 3,000 ms
コード長 420 bytes
コンパイル時間 514 ms
コンパイル使用メモリ 63,816 KB
実行使用メモリ 12,392 KB
最終ジャッジ日時 2025-01-02 08:00:51
合計ジャッジ時間 9,898 ms
ジャッジサーバーID
(参考情報)
judge3 / judge1
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp:17:1: warning: ISO C++ forbids declaration of ‘main’ with no type [-Wreturn-type]
   17 | main()
      | ^~~~

ソースコード

diff #

#include<iostream>
#include<algorithm>
using namespace std;
int N;
long K[3<<17],L[3<<17],D[3<<17];
bool cnt(long X)
{
	long ret=0;
	for(int i=0;i<N;i++)
	{
		if(X<L[i])continue;
		long r=X-L[i]>>D[i];
		ret=(ret+min(r+1,K[i]))%2;
	}
	return ret%2==1;
}
main()
{
	cin>>N;
	for(int i=0;i<N;i++)cin>>K[i]>>L[i]>>D[i];
	long L=-1,R=2e18;
	while(R-L>1)
	{
		long M=(L+R)/2;
		if(cnt(M))R=M;
		else L=M;
	}
	cout<<R<<endl;
}
0