Submission #1315842

#TimeUsernameProblemLanguageResultExecution timeMemory
1315842penguin133Subway (info1cup19_subway)C++20
0 / 100
1 ms1080 KiB
// Source: https://usaco.guide/general/io #include <bits/stdc++.h> using namespace std; int main() { int n; cin >> n; int ans[200005], tot = 0, b = 0; ans[0] = -1; for (int i = 1; i <= n; i++) { if (tot + i >= n) { int req = n - tot; ans[i] = req - 1; b = i + 1; break; } else { tot += i; ans[i] = i - 1; } } cout << b << '\n'; for (int i = 0; i < b; i++) cout << i << ' ' << ans[i] << '\n'; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...