제출 #866405

#제출 시각아이디문제언어결과실행 시간메모리
866405JellyTheOctopusSubway (info1cup19_subway)C++17
93.06 / 100
5 ms1368 KiB
#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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...