Submission #845440

#TimeUsernameProblemLanguageResultExecution timeMemory
845440vjudge1Konstrukcija (COCI20_konstrukcija)C++17
0 / 110
1 ms348 KiB
#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 (stderr)

konstrukcija.cpp: In function 'int main()':
konstrukcija.cpp:9:9: warning: unused variable 'l' [-Wunused-variable]
    9 |     int l=0;
      |         ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...