Submission #839073

#TimeUsernameProblemLanguageResultExecution timeMemory
839073fanwenSubway (info1cup19_subway)C++17
100 / 100
8 ms724 KiB
/** * 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.
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...