답안 #839065

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
839065 2023-08-28T14:56:33 Z fanwen Subway (info1cup19_subway) C++17
0 / 100
513 ms 65480 KB
/**
 *      author : pham van sam 
 *      created : 28 August 2023 (Monday)
 **/

#include <bits/stdc++.h>

using namespace std;

void you_make_it(void) {
    int k, n; cin >> k;
    for (int i = 1; 1LL * i * (i + 1) <= 2LL * k; ++i) {
    	n = i;
    }
    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.

Compilation message

subway.cpp: In function 'void you_make_it()':
subway.cpp:17:20: warning: 'n' may be used uninitialized in this function [-Wmaybe-uninitialized]
   17 |  for (int i = 0; i <= n; ++i) {
      |                  ~~^~~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 513 ms 65480 KB Integer parameter [name=N] equals to 4195825, violates the range [1, 1000000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 513 ms 65480 KB Integer parameter [name=N] equals to 4195825, violates the range [1, 1000000]
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 513 ms 65480 KB Integer parameter [name=N] equals to 4195825, violates the range [1, 1000000]
2 Halted 0 ms 0 KB -