# | 제출 시각UTC-0 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
701745 | scottchou | Maja (COCI18_maja) | C++17 | 4 ms | 468 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
using namespace std;
typedef long long LL;
int const N = 105;
LL dp[2][N][N];
LL c[N][N];
int dis[4][2] = {{1, 0}, {-1, 0}, {0, 1}, {0, -1}};
int main(){
ios::sync_with_stdio(0);
cin.tie(0);
int n, m, k, x, y;
cin >> n >> m >> x >> y >> k;
for(int i = 1; i <= n; i++){
for(int j = 1; j <= m; j++){
cin >> c[i][j];
dp[0][i][j] = -1e18;
}
}
if(k <= 10000){
bool now = 0;
dp[0][x][y] = 0;
while(k--){
for(int i = 1; i <= n; i++){
for(int j = 1; j <= n; j++){
dp[!now][i][j] = -1e18;
for(int s = 0; s < 4; s++){
int tox = i + dis[s][0], toy = j +dis[s][1];
if(tox > 0 && tox <= n && toy > 0 && toy <= m){
dp[!now][i][j] = max(dp[!now][i][j], dp[now][tox][toy]);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |