| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 496003 | vulpes | Jump (BOI06_jump) | C++17 | 8 ms | 1648 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
struct number {
vector<int> a;
number() {
a = {0};
}
number operator+(const number &x) {
number y; y.a.resize(max(x.a.size(), a.size()) + 1);
for (int i = 0; i < max(x.a.size(), a.size()); i++) {
int f = (i < x.a.size() ? x.a[i] : 0);
int s = (i < a.size() ? a[i] : 0);
y.a[i] += f + s;
y.a[i + 1] += y.a[i] / 10;
y.a[i] %= 10;
}
while (y.a.size() > 1 && !y.a.back()) {
y.a.pop_back();
}
return y;
}
};
void print(number x) {
for (int i = x.a.size(); i; i--) {
cout << x.a[i - 1];
}
}
int main() {
ios_base::sync_with_stdio(false);
cin.tie(0); cout.tie(0);
int n; cin >> n;
vector<vector<int>> a(n, vector<int>(n));
for (int i = 0; i < n; i++) {
for (int j = 0; j < n; j++) {
cin >> a[i][j];
}
}
vector<vector<number>> d(n, vector<number>(n));
d[0][0].a = {1};
for (int i = 0; i < n; i++) {
for (int j = 0; j < n - (i == n - 1); j++) {
if (i + a[i][j] < n) {
d[i + a[i][j]][j] = d[i + a[i][j]][j] + d[i][j];
}
if (j + a[i][j] < n) {
d[i][j + a[i][j]] = d[i][j + a[i][j]] + d[i][j];
}
}
}
print(d[n - 1][n - 1]);
return cout << endl, 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
