답안 #839073

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
839073 2023-08-28T15:02:41 Z fanwen Subway (info1cup19_subway) C++17
100 / 100
8 ms 724 KB
/**
 *      author : pham van sam 
 *      created : 28 August 2023 (Monday)
 **/

#include <bits/stdc++.h>

using namespace std;

#define int long long

void you_make_it(void) {
    int k, n = 1; cin >> k;
    while(1LL * n * (n + 1) / 2 <= k) n++;
    n--;
    int diff = k - 1LL * n * (n + 1) / 2;
    cout << n + 1 + (diff > 0) << '\n';
	for (int i = 0; i <= n; ++i) {
		cout << i << " " << i - 1 << '\n';
	}
    if(diff > 0) {
    	cout << n + 1 << " " << diff  - 1 << '\n';
    }
}

signed main() {

#ifdef LOCAL
    freopen("TASK.inp", "r", stdin);
    freopen("TASK.out", "w", stdout);
#endif
    auto start_time = chrono::steady_clock::now();

    cin.tie(0), cout.tie(0) -> sync_with_stdio(0);

    you_make_it();

    auto end_time = chrono::steady_clock::now();

    cerr << "\nExecution time : " << chrono::duration_cast <chrono::milliseconds> (end_time - start_time).count() << "[ms]" << endl;

    return (0 ^ 0);
}

// Dream it. Wish it. Do it.
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Correct 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 320 KB Output is correct
8 Correct 0 ms 224 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 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 0 ms 212 KB Output is correct
4 Correct 0 ms 212 KB Output is correct
5 Correct 0 ms 212 KB Output is correct
6 Correct 1 ms 212 KB Output is correct
7 Correct 0 ms 320 KB Output is correct
8 Correct 0 ms 224 KB Output is correct
9 Correct 0 ms 212 KB Output is correct
10 Correct 0 ms 212 KB Output is correct
11 Correct 2 ms 340 KB Output is correct
12 Correct 2 ms 340 KB Output is correct
13 Correct 2 ms 340 KB Output is correct
14 Correct 2 ms 340 KB Output is correct
15 Correct 2 ms 340 KB Output is correct
16 Correct 8 ms 724 KB Output is correct
17 Correct 1 ms 340 KB Output is correct
18 Correct 5 ms 724 KB Output is correct
19 Correct 4 ms 596 KB Output is correct
20 Correct 4 ms 596 KB Output is correct