Submission #866404

#TimeUsernameProblemLanguageResultExecution timeMemory
866404JellyTheOctopusSubway (info1cup19_subway)C++17
0 / 100
1 ms464 KiB
#include <bits/stdc++.h> using namespace std; #define fi first #define se second const int MOD = 1e9+7; const int MAX_N = 44721; int K; int tri[MAX_N+1]; int cnt[MAX_N+1]; int main() { ios::sync_with_stdio(false); cin.tie(nullptr); cin >> K; if (K == 0) { cout << 0 << "\n"; return 0; } for (int i = 1; i <= MAX_N; i++) { tri[i] = i*(i+1)/2; } int N = 1; for (int i = MAX_N; i >= 1; i--) { cnt[i] = K / tri[i]; N += i*cnt[i]; K %= tri[i]; } cout << N << "\n"; cout << 0 << " " << -1 << "\n"; int curVal = 0; for (int i = 1; i <= MAX_N; i++) { for (int j = 1; j <= cnt[i]; j++) { for (int k = 1; k <= i; k++) { curVal++; if (k == 1) { cout << curVal << " " << 0 << "\n"; continue; } cout << curVal << " " << curVal-1 << "\n"; } } } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...