This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#pragma GCC optimize("unroll-loops,Ofast,O3")
#include <bits/stdc++.h>
#define pb push_back
#define mp make_pair
#define spc << " " <<
#define all(x) x.begin(), x.end()
#define ll long long
#define int long long
#define ii pair<int,int>
#define vi vector<int>
#define vii vector<ii>
#define st first
#define nd second
#define inf 1000000009
#define MOD 1000000007
using namespace std;
void solve(){
int k; cin >> k;
if(k==1){
cout << "1 0" << endl;
return;
}
if(k==0){
cout << "3 2" << endl;
cout << "1 2" << endl;
cout << "2 3" << endl;
return;
}
if(1<=k && k<500){
cout << k+3 spc 2*k+2 << endl;
for(int i=2; i<=k+2; i++){
cout << 1 spc i << endl;
cout << i spc k+3 << endl;
}
return;
}
if(-300<k && k<=1){
k*=-1;
for(int a=2; a<=300; a++){
for(int b=a; b<=300; b++){
if((a*b)+1-a-b != k) continue;
cerr << a spc b << endl;
cout << (a+b+2) spc (a*b+a+b) << endl;
for(int i=2; i<=a+1; i++) cout << 1 spc i << endl;
for(int i=a+2; i<=a+b+1; i++) cout << i spc a+b+2 << endl;
for(int i=2; i<=a+1; i++){
for(int j=a+2; j<=a+b+1; j++) cout << i spc j << endl;
}
return;
}
}
}
}
signed main(){
ios_base::sync_with_stdio(false);cin.tie(0);
#ifdef Local
freopen("in.txt","r",stdin);
freopen("out","w",stdout);
#endif
ll t=1;
//cin >> t;
while(t--) solve();
}
# | 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... |