답안 #940505

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940505 2024-03-07T10:04:16 Z shenfe1 웜뱃 (IOI13_wombats) C++17
28 / 100
2738 ms 23568 KB
#include <bits/stdc++.h>

#pragma optimize("Ofast")
#pragma target("avx2")

using namespace std;

#define ll long long
#define ld long double
#define pb push_back
#define pf push_front
#define pii pair<int,int>
#define all(v) v.begin(),v.end()
#define F first
#define S second
#define mem(a,i) memset(a,i,sizeof(a))
#define sz(s) (int)s.size()
#define y1 yy
#define ppb pop_back
#define lb lower_bound
#define ub upper_bound
#define gcd(a,b) __gcd(a,b)
#define in insert
// #define int ll

const int MAX=200+15;
const ll inf=1e9;  
const int mod=1e9+7;
const int mod1=1e9+9;
const ld eps=1e-9;

int dx[8]={1,0,-1,0,1,-1,-1,1};
int dy[8]={0,1,0,-1,1,-1,1,-1};

int binpow(int a,int n){
  if(!n)return 1;
  if(n%2==1)return a*binpow(a,n-1);
  int k=binpow(a,n/2);
  return k*k;
}

#include "wombats.h"

int h[MAX][MAX];
int v[MAX][MAX];
int n,m;
int d[MAX][MAX][MAX];

void calc(int st){
  d[st][n-1][st]=0;
  for(int j=st+1;j<m;j++){
    d[st][n-1][j]=d[st][n-1][j-1]+h[n-1][j-1];
  }
  for(int j=st-1;j>=0;j--){
    d[st][n-1][j]=d[st][n-1][j+1]+h[n-1][j];
  }
  for(int i=n-2;i>=0;i--){
    int pmn[210];
    int smn[210];
    pmn[0]=d[st][i+1][0]+v[i][0];
    for(int j=1;j<m;j++){
      pmn[j]=min(pmn[j-1]+h[i][j-1],d[st][i+1][j]+v[i][j]);
    }
    smn[m-1]=d[st][i+1][m-1]+v[i][m-1];
    for(int j=m-2;j>=0;j--){
      smn[j]=min(smn[j+1]+h[i][j],d[st][i+1][j]+v[i][j]);
    }
    for(int j=0;j<m;j++){
      d[st][i][j]=min(smn[j],pmn[j]);
    }
  }
}

void init(int R, int C, int H[5000][200], int V[5000][200]) {
  n=R;
  m=C;
  for(int i=0;i<R;i++){
    for(int j=0;j<C-1;j++){
      h[i][j]=H[i][j];
    }
  }
  for(int i=0;i<R-1;i++){
    for(int j=0;j<C;j++){
      v[i][j]=V[i][j];
    }
  }
  for(int i=0;i<m;i++)calc(i);
}

void changeH(int P, int Q, int W) {
  h[P][Q]=W;
  for(int i=0;i<m;i++){
    calc(i);
  }
}

void changeV(int P, int Q, int W) {
  v[P][Q]=W;
  for(int i=0;i<m;i++){
    calc(i);
  }
}

int escape(int V1, int V2) {
  return d[V2][0][V1];
}

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;
      |      ^~~
wombats.cpp:3: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
    3 | #pragma optimize("Ofast")
      | 
wombats.cpp:4: warning: ignoring '#pragma target ' [-Wunknown-pragmas]
    4 | #pragma target("avx2")
      |
# 결과 실행 시간 메모리 Grader output
1 Runtime error 6 ms 9820 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 2396 KB Output is correct
2 Correct 1 ms 2396 KB Output is correct
3 Correct 1 ms 2392 KB Output is correct
4 Correct 1 ms 8540 KB Output is correct
5 Correct 2 ms 8540 KB Output is correct
6 Correct 1 ms 8536 KB Output is correct
7 Correct 1 ms 8540 KB Output is correct
8 Correct 1 ms 8540 KB Output is correct
9 Correct 1 ms 8540 KB Output is correct
10 Correct 2 ms 8540 KB Output is correct
11 Correct 55 ms 10764 KB Output is correct
12 Correct 1 ms 8540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 558 ms 23312 KB Output is correct
2 Correct 542 ms 23308 KB Output is correct
3 Correct 553 ms 23128 KB Output is correct
4 Correct 564 ms 23328 KB Output is correct
5 Correct 538 ms 23320 KB Output is correct
6 Correct 1 ms 2392 KB Output is correct
7 Correct 1 ms 2396 KB Output is correct
8 Correct 1 ms 2396 KB Output is correct
9 Correct 2738 ms 23312 KB Output is correct
10 Correct 1 ms 4444 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Runtime error 10 ms 18012 KB Execution killed with signal 11
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 559 ms 23320 KB Output is correct
2 Correct 526 ms 23376 KB Output is correct
3 Correct 541 ms 23320 KB Output is correct
4 Correct 550 ms 23316 KB Output is correct
5 Correct 552 ms 23316 KB Output is correct
6 Runtime error 10 ms 18008 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 553 ms 23568 KB Output is correct
2 Correct 577 ms 23308 KB Output is correct
3 Correct 550 ms 23320 KB Output is correct
4 Correct 573 ms 23316 KB Output is correct
5 Correct 538 ms 23132 KB Output is correct
6 Runtime error 12 ms 17756 KB Execution killed with signal 11
7 Halted 0 ms 0 KB -