結果

問題 No.814 ジジ抜き
ユーザー 沙耶花沙耶花
提出日時 2020-12-08 16:59:00
言語 C++17
(gcc 13.3.0 + boost 1.87.0)
結果
AC  
実行時間 327 ms / 3,000 ms
コード長 576 bytes
コンパイル時間 2,285 ms
コンパイル使用メモリ 194,236 KB
最終ジャッジ日時 2025-01-16 19:47:04
ジャッジサーバーID
(参考情報)
judge5 / judge3
このコードへのチャレンジ
(要ログイン)
ファイルパターン 結果
sample AC * 3
other AC * 23
権限があれば一括ダウンロードができます
コンパイルメッセージ
main.cpp: In function ‘int main()’:
main.cpp:13:22: warning: ignoring return value of ‘int scanf(const char*, ...)’ declared with attribute ‘warn_unused_result’ [-Wunused-result]
   13 |                 scanf("%lld %lld %lld",&K[i],&L[i],&D[i]);
      |                 ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

ソースコード

diff #

#include <bits/stdc++.h>
using namespace std;
#define rep(i,n) for (int i = 0; i < (n); ++i)
#define Inf 1000000000

int main(){
	
	int N;
	cin>>N;
	
	vector<long long> K(N),L(N),D(N);
	rep(i,N){
		scanf("%lld %lld %lld",&K[i],&L[i],&D[i]);
	}
	
	long long ok = 1000000000000000000,ng = -1;
	
	while(ok-ng>1){
		long long mid = (ok+ng)/2;
		
		int sum = 0;
		
		rep(i,N){
			if(mid<L[i])continue;
			long long temp = mid-L[i];
			long long x = min(K[i],temp / (1LL<<D[i]) + 1);
			sum ^= x&1;
		}
		
		if(sum)ok = mid;
		else ng = mid;
		
	}
	
	cout<<ok<<endl;
	
	return 0;
}
0