#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define FOR(i,a,b) for (auto i = (a); i <= (b); ++i)
#define NFOR(i,a,b) for(auto i = (a); i >= (b); --i)
#define all(x) (x).begin(), (x).end()
#define sz(x) int(x.size())
#define mp(i,a) make_pair(i,a)
#define pb(a) push_back(a)
#define bit(x,b) (x&(1LL<<b))
typedef long long int lli;
typedef pair <lli,lli> ii;
typedef pair <lli,ii> iii;
typedef vector <int> vi;
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
lli k;
cin>>k;
int s,m=2;
if(k>=0)
s=1;
else
s=-1;
k=abs(k);
vi al[1001];
al[998].pb(1000);
al[999].pb(1000);
int c1=999,c0=998;
for(int i=0;i<64;++i)
{
c1-=2;
c0-=2;
al[c0].pb(c0+2);
al[c0].pb(c0+3);
al[c1].pb(c1+1);
al[c1].pb(c1+2);
m+=4;
}
c0--;
for(int i=0;i<64;++i)
{
if(bit(k,i))
{
int f=(1000-(i+1)*2);
if(f%4==2)
{
if(s==1)
{
al[1].pb(f);
m+=1;
}
else
{
al[c0].pb(f);
al[1].pb(c0);
c0--;
m+=2;
}
}
else
{
if(s==-1)
{
al[1].pb(f);
m+=1;
}
else
{
al[c0].pb(f);
al[1].pb(f);
m+=2;
}
}
}
}
cout<<1000<<' '<<m<<endl;
for(int i=1;i<=1000;++i)
{
for(int j=0;j<al[i].size();++j)
cout<<i<<' '<<al[i][j]<<endl;
}
return 0;
}
Compilation message
konstrukcija.cpp: In function 'int main()':
konstrukcija.cpp:82:18: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
for(int j=0;j<al[i].size();++j)
~^~~~~~~~~~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Wrong answer. |
2 |
Halted |
0 ms |
0 KB |
- |