#include<bits/stdc++.h>
using namespace std;
int d[(int)1e6+2];
signed main(){
ios::sync_with_stdio(0);
cin.tie(0);
vector<array<int,2>>g={{0,-1}};
int k;
cin>>k;
int node=0,av=0;
d[0]=0;
while(k){
if(av+1<=k){//spawnam novi node
g.push_back({++node,node-1});
d[++av]=node;
k-=av;
}else{
g.push_back({++node,d[k-1]});
break;
}
}
cout<<g.size()<<'\n';
for(auto&[x,y]:g)
cout<<x<<' '<<y<<'\n';
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |