# Bzoj4725 [poi2017]reprezentacje ró_nicowe

## 智商题

Posted by yjjr's blog on April 6, 2018

# 题目

## Sample Input

2
17
18


## Sample Output

6 3
16 15


# code

#include<iostream>
#include<cstdio>
#include<cstdlib>
#include<cmath>
#include<cstring>
#include<algorithm>
#include<map>
#define rep(i,a,b) for(int i=a;i<=b;i++)
#define dep(i,a,b) for(int i=a;i>=b;i--)
#define ll long long
#define mem(x,num) memset(x,num,sizeof x)
#define reg(x) for(int i=last[x];i;i=e[i].next)
using namespace std;
ll f=1,x=0;char ch=getchar();
while(ch<'0'||ch>'9'){if(ch=='-')f=-1;ch=getchar();}
while(ch>='0'&&ch<='9'){x=x*10+ch-'0';ch=getchar();}
return x*f;
}
#define mp make_pair
#define fi first
#define se second
const int maxn=1e6+6;
map<int,pair<int,int> >s;
typedef map<int ,pair<int ,int > >::iterator it;
int q,n=3,a[maxn],b[maxn],cnt;
int main()
{
a[1]=1,a[2]=2;
s[1]=mp(2,1);
while(1){
if(n&1)a[n]=a[n-1]*2;
else for(int j=1;;j++)if(!s.count(j)){a[n]=a[n-1]+j;break;}
rep(j,1,n-1)s[a[n]-a[j]]=mp(n,j);
if((!(n&1))&&a[n]>1e9)break;n++;
}
for(it l=s.begin();l!=s.end();l++)b[++cnt]=l->first;