結果

問題 No.413 +5,000,000pts
ユーザー 👑 kmjpkmjp
提出日時 2016-08-12 23:44:30
言語 C++11
(gcc 11.4.0)
結果
AC  
実行時間 40 ms / 5,000 ms
コード長 1,066 bytes
コンパイル時間 1,206 ms
コンパイル使用メモリ 165,092 KB
実行使用メモリ 8,192 KB
最終ジャッジ日時 2024-04-25 05:52:04
合計ジャッジ時間 1,628 ms
ジャッジサーバーID
(参考情報)
judge3 / judge5
このコードへのチャレンジ
(要ログイン)

テストケース

テストケース表示
入力 結果 実行時間
実行使用メモリ
testcase_00 AC 40 ms
8,192 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))
//-------------------------------------------------------

void solve() {
	int i,j,k,l,r,x,y; string s;
	set<ll> R;
	
	FOR(i,100) {
		FOR(j,1000000) {
			ll a=j+(1LL<<29);
			a=a*a-50+i;
			ll d=(a-1)/4;
			
			volatile double c = 1 + 4*d;
			volatile ll b = c;
			
			ll t=(ll)((-1 + sqrt(b)) / 2.0);
			if(t*t+t>d || (t+1)*(t+1)+(t+1)<=d) {
				R.insert(d);
				if(R.size()==100000) {
					FORR(r,R) _P("%lld\n",r);
					return;
				}
			}
		}
	}
    return;
	
}


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);
	solve(); return 0;
}
0