답안 #637359

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
637359 2022-09-01T13:45:57 Z tvladm2009 Subway (info1cup19_subway) C++14
100 / 100
8 ms 768 KB
#include <bits/stdc++.h>

using namespace std;

typedef long long ll;
typedef long double ld;

int k;

int main() {
    ios_base::sync_with_stdio(false);
    cin.tie(0);
    cout.tie(0);

    cin >> k;
    int n = 1;
    while (n * (n - 1) / 2 < k) {
        n++;
    }
    if (n * (n - 1) / 2 == k) {
        cout << n << "\n";
        for (int i = 0; i < n; i++) {
            cout << i << " " << i - 1 << "\n";
        }
    } else {
        n--;
        cout << n + 1 << "\n";
        for (int i = 0; i < n; i++) {
            cout << i << " " << i - 1 << "\n";
        }
        cout << n << " " << k - n * (n - 1) / 2 - 1 << "\n";
    }
    
    return 0;
}
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 316 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 1 ms 320 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 1 ms 316 KB Output is correct
6 Correct 1 ms 320 KB Output is correct
7 Correct 1 ms 324 KB Output is correct
8 Correct 1 ms 212 KB Output is correct
9 Correct 1 ms 212 KB Output is correct
10 Correct 1 ms 316 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 3 ms 316 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 2 ms 324 KB Output is correct
16 Correct 7 ms 724 KB Output is correct
17 Correct 1 ms 212 KB Output is correct
18 Correct 8 ms 768 KB Output is correct
19 Correct 5 ms 596 KB Output is correct
20 Correct 5 ms 596 KB Output is correct