Submission #237798

#TimeUsernameProblemLanguageResultExecution timeMemory
237798akatKonstrukcija (COCI20_konstrukcija)C++14
0 / 110
5 ms384 KiB
#include<bits/stdc++.h> using namespace std; int main() { ios_base::sync_with_stdio(0); cin.tie(0); long long n; cin>>n; if(n == 0) { cout<<"6 6\n1 4\n1 5\n4 3\n5 3\n3 2\n2 6\n"; return 0; } int i,a[61][2],cnt = 4; vector<pair<int,int>>edges; a[0][0] = 2; a[0][1] = 1; edges.push_back({1,2}); edges.push_back({1,3}); edges.push_back({1,4}); for(i = 1; i < 6;i ++) { a[i][i^1] = cnt + 1; edges.push_back({cnt - 2,cnt + 1}); edges.push_back({cnt - 2,cnt + 2}); edges.push_back({cnt - 1,cnt + 1}); edges.push_back({cnt - 1,cnt + 2}); cnt += 3; a[i][i&1] = cnt; } bool l = 0; if(n < 0) l = 1; cnt ++; i = 0; while(n) { if(n & 1) edges.push_back({a[i][l],cnt}); n /= 2; i++; } cout<<cnt<<" "<<edges.size()<<'\n'; for(auto x:edges) cout<<x.first<<" "<<x.second<<'\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...