이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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";
}
}
}
}
컴파일 시 표준 에러 (stderr) 메시지
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |