#include <bits/stdc++.h>
using namespace std;
#define fi first
#define se second
const int MOD = 1e9+7;
const int MAX_N = 44721;
int K;
int tri[MAX_N+1];
int cnt[MAX_N+1];
int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);
cin >> K;
for (int i = 1; i <= MAX_N; i++) {
tri[i] = i*(i+1)/2;
}
int N = 1;
for (int i = MAX_N; i >= 1; i--) {
cnt[i] = K / tri[i];
N += i*cnt[i];
K %= tri[i];
}
cout << N << "\n";
cout << 0 << " " << -1 << "\n";
int curVal = 0;
for (int i = 1; i <= MAX_N; i++) {
for (int j = 1; j <= cnt[i]; j++) {
for (int k = 1; k <= i; k++) {
curVal++;
if (k == 1) {
cout << curVal << " " << 0 << "\n";
continue;
}
cout << curVal << " " << curVal-1 << "\n";
}
}
}
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
856 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
856 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
600 KB |
Output is correct |
8 |
Correct |
1 ms |
600 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
600 KB |
Output is correct |
2 |
Correct |
1 ms |
604 KB |
Output is correct |
3 |
Correct |
1 ms |
600 KB |
Output is correct |
4 |
Correct |
1 ms |
604 KB |
Output is correct |
5 |
Correct |
1 ms |
856 KB |
Output is correct |
6 |
Correct |
1 ms |
604 KB |
Output is correct |
7 |
Correct |
1 ms |
600 KB |
Output is correct |
8 |
Correct |
1 ms |
600 KB |
Output is correct |
9 |
Correct |
1 ms |
604 KB |
Output is correct |
10 |
Correct |
1 ms |
604 KB |
Output is correct |
11 |
Partially correct |
2 ms |
860 KB |
Partially correct |
12 |
Partially correct |
2 ms |
860 KB |
Partially correct |
13 |
Partially correct |
2 ms |
860 KB |
Partially correct |
14 |
Partially correct |
2 ms |
860 KB |
Partially correct |
15 |
Partially correct |
2 ms |
860 KB |
Partially correct |
16 |
Partially correct |
5 ms |
1116 KB |
Partially correct |
17 |
Partially correct |
1 ms |
604 KB |
Partially correct |
18 |
Partially correct |
5 ms |
1116 KB |
Partially correct |
19 |
Correct |
4 ms |
1112 KB |
Output is correct |
20 |
Correct |
4 ms |
1368 KB |
Output is correct |