結果

問題 No.814 ジジ抜き
ユーザー Lepton_sLepton_s
提出日時 2018-02-21 13:37:14
言語 C++17
(gcc 12.3.0 + boost 1.83.0)
結果
AC  
実行時間 186 ms / 3,000 ms
コード長 991 bytes
コンパイル時間 1,424 ms
コンパイル使用メモリ 76,968 KB
実行使用メモリ 8,944 KB
最終ジャッジ日時 2023-10-13 10:52:24
合計ジャッジ時間 5,415 ms
ジャッジサーバーID
(参考情報)
judge14 / judge12
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 2 ms
4,352 KB
testcase_01 AC 1 ms
4,348 KB
testcase_02 AC 1 ms
4,352 KB
testcase_03 AC 3 ms
4,348 KB
testcase_04 AC 121 ms
8,808 KB
testcase_05 AC 119 ms
8,864 KB
testcase_06 AC 145 ms
8,944 KB
testcase_07 AC 75 ms
5,964 KB
testcase_08 AC 126 ms
8,600 KB
testcase_09 AC 107 ms
7,176 KB
testcase_10 AC 186 ms
8,596 KB
testcase_11 AC 144 ms
8,680 KB
testcase_12 AC 83 ms
6,044 KB
testcase_13 AC 87 ms
5,916 KB
testcase_14 AC 134 ms
7,228 KB
testcase_15 AC 63 ms
5,152 KB
testcase_16 AC 56 ms
5,636 KB
testcase_17 AC 115 ms
7,624 KB
testcase_18 AC 125 ms
6,964 KB
testcase_19 AC 152 ms
8,628 KB
testcase_20 AC 80 ms
6,048 KB
testcase_21 AC 87 ms
6,228 KB
testcase_22 AC 109 ms
8,020 KB
testcase_23 AC 66 ms
5,428 KB
testcase_24 AC 107 ms
7,368 KB
testcase_25 AC 80 ms
6,564 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <cstdio>
#include <iostream>
#include <vector>
typedef long long ll;
typedef unsigned long long ull;
#define REP(i,a,b) for(ll (i)=a;(i)<(ll)(b);++(i))
#define rep(i,n) REP(i,0,n)
using namespace std;
const ull cycle_per_sec = 2800000000;
ull begin_cycle;
ull get_cycle(){
	unsigned int low, high;
	__asm__ volatile ("rdtsc" : "=a" (low), "=d" (high));
	return ((ull) low) | ((ull) high << 32);
}
double get_time(){
	return (double) (get_cycle() - begin_cycle)/cycle_per_sec;
}

int main(){
	//std::ios::sync_with_stdio(false);std::cin.tie(0);
	int N;
	scanf("%d",&N);
	vector<ll> K(N), L(N);
	vector<int> D(N);
	rep(i, N) scanf("%lld%lld%d",&K[i],&L[i],&D[i]);
	begin_cycle = get_cycle();
	ll lb = -1, ub = (ll)1e18+10;
	while(ub-lb>1){
		ll md = (lb+ub+1)/2;
		int x = 0;
		rep(i, N){
			ll t = md-L[i];
			if(t<0) continue;
			t >>= D[i];
			t = min(t, K[i]-1);
			if(t%2==0) x = !x;
		}
		(x==1?ub:lb)=md;
	}
	double t = get_time();
	cerr<<t<<endl;
	cout<<ub<<endl;
	return 0;
}
0