#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main(){
ios_base::sync_with_stdio(false);
int k; cin >> k;
int l=0;
vector<array<int, 2>> a;
vector<int> v(60);
a.push_back({0, 1});
a.push_back({0, 2});
a.push_back({1, 3});
a.push_back({2, 3});
v[0]=0;
v[1]=3;
int cnt=4;
for(int l=2; l<60; l++){
a.push_back({v[l-1], cnt}); cnt++;
a.push_back({v[l-1], cnt}); cnt++;
a.push_back({cnt-2, cnt});
a.push_back({cnt-1, cnt});
v[l]=cnt; cnt++;
}
if(k==0){
cout<<"3 3 1 2 1 3 2 3";
}
else{
if(k<0){
k=abs(k);
int pf=0;
for(int l=0; l<60; l++){
if(k&(1LL<<l)) pf++;
}
int n = cnt+pf;
for(int l=0; l<60; l++){
if(k&(1LL<<l)){
pf++;
a.push_back({v[l], cnt});
a.push_back({cnt, n});
}
}
cout<<n+1<<" "<<a.size()<<"\n";
for(auto i: a){
cout<<i[0]+1<<" "<<i[1]+1<<"\n";
}
}
else{
k=abs(k);
int n = cnt;
for(int l=0; l<60; l++){
if(k&(1LL<<l)){
a.push_back({v[l], cnt});
}
}
cout<<n+1<<" "<<a.size()<<"\n";
for(auto i: a){
cout<<i[0]+1<<" "<<i[1]+1<<"\n";
}
}
}
}
Compilation message
konstrukcija.cpp: In function 'int main()':
konstrukcija.cpp:9:9: warning: unused variable 'l' [-Wunused-variable]
9 | int l=0;
| ^
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong output format. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
348 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |