# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1091680 | 2024-09-21T19:39:38 Z | svm | Snail (NOI18_snail) | C++14 | 2 ms | 604 KB |
#include <bits/stdc++.h> #define TASK "snail" using namespace std; #define fst first #define snd second typedef long long int64; typedef pair<int, int> pii; int64 rdiv(int64 a, int64 b) { if (a <= 0) return 0; return (a + b - 1)/ b; } int main() { #ifndef ONLINE_JUDGE freopen(TASK".inp", "r", stdin); freopen(TASK".out", "w", stdout); #endif cin.tie(0)->sync_with_stdio(false); int64 h; int n; cin >> h >> n; vector<int64> p (n + 5); int64 sum_p = 0, max_p = 0; for (int i = 0; i < n; i++) { cin >> p[i]; sum_p += p[i]; max_p = max(max_p, sum_p); } if (sum_p <= 0) { cout << "-1 -1\n"; return 0; } int64 day = rdiv(h - max_p, sum_p); int64 curr_height = day * sum_p; if (curr_height >= h) { cout << day - 1 << ' ' << n - 1 << '\n'; return 0; } for (int i = 0; i < n; i++) { curr_height += p[i]; if (curr_height >= h) { cout << day << ' ' << i << '\n'; return 0; } } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 604 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 600 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 604 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 604 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |