#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 |
1 |
Correct |
2 ms |
460 KB |
Correct. |
2 |
Correct |
1 ms |
600 KB |
Correct. |
3 |
Correct |
1 ms |
348 KB |
Correct. |
4 |
Correct |
1 ms |
344 KB |
Correct. |
5 |
Correct |
2 ms |
344 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Correct. |
2 |
Correct |
1 ms |
344 KB |
Correct. |
3 |
Correct |
1 ms |
348 KB |
Correct. |
4 |
Correct |
1 ms |
344 KB |
Correct. |
5 |
Correct |
2 ms |
344 KB |
Correct. |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
460 KB |
Correct. |
2 |
Correct |
1 ms |
600 KB |
Correct. |
3 |
Correct |
1 ms |
348 KB |
Correct. |
4 |
Correct |
1 ms |
344 KB |
Correct. |
5 |
Correct |
2 ms |
344 KB |
Correct. |
6 |
Correct |
1 ms |
344 KB |
Correct. |
7 |
Correct |
1 ms |
344 KB |
Correct. |
8 |
Correct |
1 ms |
348 KB |
Correct. |
9 |
Correct |
1 ms |
344 KB |
Correct. |
10 |
Correct |
2 ms |
344 KB |
Correct. |
11 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |
12 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
460 KB |
Correct. |
2 |
Correct |
1 ms |
600 KB |
Correct. |
3 |
Correct |
1 ms |
348 KB |
Correct. |
4 |
Correct |
1 ms |
344 KB |
Correct. |
5 |
Correct |
2 ms |
344 KB |
Correct. |
6 |
Correct |
1 ms |
344 KB |
Correct. |
7 |
Correct |
1 ms |
344 KB |
Correct. |
8 |
Correct |
1 ms |
348 KB |
Correct. |
9 |
Correct |
1 ms |
344 KB |
Correct. |
10 |
Correct |
2 ms |
344 KB |
Correct. |
11 |
Incorrect |
0 ms |
348 KB |
Unexpected end of file - int32 expected |
12 |
Halted |
0 ms |
0 KB |
- |