# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
201087 | 2020-02-09T10:15:23 Z | SamAnd | Jetpack (COCI16_jetpack) | C++17 | 25 ms | 7920 KB |
#include <bits/stdc++.h> using namespace std; #define m_p make_pair const int N = 100005; int m; char a[12][N]; bool c[12][N]; int p[12][N]; int main() { scanf("%d", &m); for (int i = 0; i < 10; ++i) { scanf(" %s", a[i]); } c[9][0] = true; for (int j = 0; j < m - 1; ++j) { for (int i = 0; i < 10; ++i) { if (!c[i][j]) continue; if (i == 9) { if (a[i][j + 1] == '.') { c[i][j + 1] = true; p[i][j + 1] = i; } } if (i == 0) { if (a[i][j + 1] == '.') { c[i][j + 1] = true; p[i][j + 1] = i; } } if (i + 1 < 10) { if (a[i + 1][j + 1] == '.') { c[i + 1][j + 1] = true; p[i + 1][j + 1] = i; } } if (i - 1 >= 0) { if (a[i - 1][j + 1] == '.') { c[i - 1][j + 1] = true; p[i - 1][j + 1] = i; } } } } vector<pair<int, int> > ans; int j = m - 1; for (int i = 0; i < 10; ++i) { if (c[i][j]) { while (1) { if (j == 0) break; if (p[i][j] > i || (p[i][j] == i && i == 0)) { ans.push_back(m_p(j - 1, 1)); } i = p[i][j]; --j; } break; } } reverse(ans.begin(), ans.end()); printf("%d\n", ans.size()); for (int i = 0; i < ans.size(); ++i) { printf("%d %d\n", ans[i].first, ans[i].second); } return 0; }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 5 ms | 504 KB | Output is correct |
2 | Correct | 5 ms | 504 KB | Output is correct |
3 | Correct | 5 ms | 504 KB | Output is correct |
4 | Correct | 5 ms | 504 KB | Output is correct |
5 | Correct | 6 ms | 760 KB | Output is correct |
6 | Correct | 6 ms | 888 KB | Output is correct |
7 | Correct | 9 ms | 1912 KB | Output is correct |
8 | Correct | 16 ms | 4088 KB | Output is correct |
9 | Correct | 19 ms | 5880 KB | Output is correct |
10 | Correct | 25 ms | 7920 KB | Output is correct |