답안 #897452

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
897452 2024-01-03T06:29:28 Z Sir_Ahmed_Imran 웜뱃 (IOI13_wombats) C++17
39 / 100
13355 ms 195156 KB
                              ///~~~LOTA~~~///
#include "wombats.h"
#include <bits/stdc++.h>
using namespace std;
#define nl '\n'
#define ff first
#define ss second
#define ll long long 
#define append push_back
#define pii pair<int,int>
#define all(x) (x).begin(),(x).end()
#define N 10000000
int n,m;
int x[5000][100];
int y[5000][100];
int dp[5000][100][100];
void compute_dp(){
    for(int i=0;i<m;i++)
        for(int j=0;j<m;j++)
            dp[n-1][i][j]=abs(x[n-1][i]-x[n-1][j]);
    for(int i=n-2;i>=0;i--){
        for(int j=0;j<m;j++){
            for(int k=0;k<m;k++){
                dp[i][j][k]=1e9;
                for(int l=0;l<m;l++)
                    dp[i][j][k]=min(dp[i][j][k],
                    dp[i+1][l][k]+abs(x[i][j]-x[i][l])+y[i][l]);
            }
        }
    }
}
void init(int R, int C, int H[5000][200], int V[5000][200]){
    n=R; m=C;
    for(int i=0;i<n;i++)
        for(int j=0;j<m-1;j++)
            x[i][j+1]=x[i][j]+H[i][j];
    for(int i=0;i<n-1;i++)
        for(int j=0;j<m;j++)
            y[i][j]=V[i][j];
    compute_dp();
}
void changeV(int p,int q,int w){
    y[p][q]=w;
    compute_dp();
}
void changeH(int p,int q,int w){
    for(int i=m-1;i>q;i--)
        x[p][i]-=x[p][i-1];
    x[p][q+1]=w;
    for(int i=q;i<m-1;i++)
        x[p][q+1]+=x[p][q];
    compute_dp();
}
int escape(int p,int q){
    return dp[0][p][q];
}

Compilation message

grader.c: In function 'int main()':
grader.c:15:6: warning: variable 'res' set but not used [-Wunused-but-set-variable]
   15 |  int res;
      |      ^~~
# 결과 실행 시간 메모리 Grader output
1 Correct 41 ms 189016 KB Output is correct
2 Correct 34 ms 190860 KB Output is correct
3 Correct 93 ms 195156 KB Output is correct
4 Correct 34 ms 190956 KB Output is correct
5 Correct 34 ms 187272 KB Output is correct
6 Correct 1 ms 4444 KB Output is correct
7 Correct 1 ms 4444 KB Output is correct
8 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 4444 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 2 ms 8536 KB Output is correct
5 Correct 2 ms 8540 KB Output is correct
6 Correct 1 ms 8672 KB Output is correct
7 Correct 2 ms 8536 KB Output is correct
8 Correct 2 ms 8536 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 1 ms 8540 KB Output is correct
11 Correct 59 ms 10584 KB Output is correct
12 Correct 2 ms 8540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13355 ms 10880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 70 ms 193376 KB Output is correct
2 Correct 66 ms 193360 KB Output is correct
3 Correct 67 ms 193360 KB Output is correct
4 Correct 91 ms 194644 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13276 ms 10880 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 13164 ms 10884 KB Output isn't correct
2 Halted 0 ms 0 KB -