結果

問題 No.413 +5,000,000pts
ユーザー hipokabahipokaba
提出日時 2016-09-12 03:25:47
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 135 ms / 5,000 ms
コード長 575 bytes
コンパイル時間 1,738 ms
コンパイル使用メモリ 144,980 KB
実行使用メモリ 4,384 KB
最終ジャッジ日時 2023-08-10 19:00:08
合計ジャッジ時間 2,433 ms
ジャッジサーバーID
(参考情報)
judge14 / judge13
このコードへのチャレンジ(β)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 135 ms
4,384 KB
権限があれば一括ダウンロードができます

ソースコード

diff #

#include <bits/stdc++.h>
#include <iostream>
#include <algorithm>

#define rep(i, n) for(int i = 0; i < (n); ++i)

using namespace std;

typedef long long ll;

ll calc(ll d){
	return (ll)((-1 + sqrt(1 + 4 * d)) / 2.0);
}

int bs(ll d){
	int l = 0, r = 1e9 + 1;
	while(r - l > 1){
		int m = (l + r) / 2;
		if(ll(m) * m + m <= d){
			l = m;
		}
		else{
			r = m;
		}
	}
	return l;
}

int main(){
	int cnt = 0;
	rep(i, 1e6){
		ll k = 1e9 - i - 1;
		k = k * k + k - 1;
		if(calc(k) != bs(k)){
			cout << k << endl;
			++cnt;
		}
		if(cnt == 100000){
			break;
		}
	}
	return 0;
}
0