# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
328805 | 2020-11-18T06:27:54 Z | ryangohca | Snail (NOI18_snail) | C++17 | 6 ms | 768 KB |
#include <bits/stdc++.h> #define int long long using namespace std; vector<int> changes; main() { int h, n; cin >> h >> n; for (int i = 0; i < n*2; i++){ if (i >= n){ changes.push_back(changes[i-n]); } else { int g; cin >> g; changes.push_back(g); } } int s = 0; for (int i = 0; i < n*2; i++){ s += changes[i]; s = max(s, 0ll); if (s >= h){ cout << i/n << ' ' << i%n << '\n'; return 0; } } s = accumulate(changes.begin(), changes.end(), 0ll); if (s <= 0) { cout << "-1 -1\n"; return 0; } else { int d = h/s * 2; int climbed = d/2*s; if (climbed >= h){ cout << d - 1 << ' ' << n - 1 << "\n"; return 0; } for (int i = 0; i < n*2; i++){ if (i == n) d++; climbed += changes[i]; if (climbed >= h){ cout << d << ' ' << i % n << '\n'; return 0; } } } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 256 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 2 ms | 748 KB | Output is correct |
6 | Correct | 2 ms | 748 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 748 KB | Output is correct |
2 | Incorrect | 1 ms | 364 KB | Output isn't correct |
3 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 2 ms | 748 KB | Output is correct |
2 | Correct | 2 ms | 748 KB | Output is correct |
3 | Correct | 6 ms | 748 KB | Output is correct |
4 | Correct | 5 ms | 768 KB | Output is correct |
5 | Correct | 5 ms | 748 KB | Output is correct |
6 | Correct | 4 ms | 748 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 1 ms | 364 KB | Output is correct |
2 | Correct | 1 ms | 364 KB | Output is correct |
3 | Correct | 0 ms | 364 KB | Output is correct |
4 | Correct | 0 ms | 364 KB | Output is correct |
5 | Correct | 1 ms | 364 KB | Output is correct |
6 | Correct | 0 ms | 364 KB | Output is correct |
7 | Correct | 1 ms | 384 KB | Output is correct |
8 | Correct | 1 ms | 256 KB | Output is correct |
9 | Correct | 1 ms | 364 KB | Output is correct |
10 | Correct | 0 ms | 364 KB | Output is correct |
11 | Correct | 0 ms | 364 KB | Output is correct |
12 | Correct | 2 ms | 748 KB | Output is correct |
13 | Correct | 2 ms | 748 KB | Output is correct |
14 | Correct | 2 ms | 748 KB | Output is correct |
15 | Incorrect | 1 ms | 364 KB | Output isn't correct |
16 | Halted | 0 ms | 0 KB | - |