//Graf acykliczny //Mateusz Wasilewski #include <bits/stdc++.h> using namespace std; int k, n=100; int main(){ ios_base::sync_with_stdio(0); cout.tie(0); cin >> k; cout << n << "\n"; for(int i=1; i<=n; ++i){ if(i<n-1){ cout << i+1 << " "; if(!(i & 1)){ if(k & 1) cout << n << "\n"; else cout << "-1\n"; k >>= 1; } else if(i<n-2) cout << i+2 << "\n"; else cout << "-1\n"; } else{ cout << "-1 -1\n"; } } return 0; }
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | //Graf acykliczny //Mateusz Wasilewski #include <bits/stdc++.h> using namespace std; int k, n=100; int main(){ ios_base::sync_with_stdio(0); cout.tie(0); cin >> k; cout << n << "\n"; for(int i=1; i<=n; ++i){ if(i<n-1){ cout << i+1 << " "; if(!(i & 1)){ if(k & 1) cout << n << "\n"; else cout << "-1\n"; k >>= 1; } else if(i<n-2) cout << i+2 << "\n"; else cout << "-1\n"; } else{ cout << "-1 -1\n"; } } return 0; } |