답안 #940519

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
940519 2024-03-07T10:11:01 Z vjudge1 웜뱃 (IOI13_wombats) C++17
55 / 100
20000 ms 212380 KB
#include <bits/stdc++.h>

#pragma optimize("Ofast")
#pragma target("avx2")
#pragma oprimize("unroll-loops")

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=101;
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[5001][MAX];
int v[5001][MAX];
int n,m;
int d[MAX][5001][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[101];
    int smn[101];
    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")
      | 
wombats.cpp:5: warning: ignoring '#pragma oprimize ' [-Wunknown-pragmas]
    5 | #pragma oprimize("unroll-loops")
      |
# 결과 실행 시간 메모리 Grader output
1 Correct 19 ms 10844 KB Output is correct
2 Correct 18 ms 10876 KB Output is correct
3 Correct 69 ms 12408 KB Output is correct
4 Correct 17 ms 10884 KB Output is correct
5 Correct 18 ms 10876 KB Output is correct
6 Correct 1 ms 4440 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 4440 KB Output is correct
4 Correct 10 ms 45404 KB Output is correct
5 Correct 7 ms 45404 KB Output is correct
6 Correct 6 ms 45656 KB Output is correct
7 Correct 5 ms 45404 KB Output is correct
8 Correct 5 ms 43356 KB Output is correct
9 Correct 6 ms 45400 KB Output is correct
10 Correct 6 ms 43352 KB Output is correct
11 Correct 68 ms 46424 KB Output is correct
12 Correct 6 ms 45400 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 614 ms 203672 KB Output is correct
2 Correct 556 ms 201556 KB Output is correct
3 Correct 565 ms 203672 KB Output is correct
4 Correct 563 ms 203860 KB Output is correct
5 Correct 578 ms 201620 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 4440 KB Output is correct
9 Correct 2745 ms 203672 KB Output is correct
10 Correct 2 ms 12636 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 46 ms 16732 KB Output is correct
2 Correct 49 ms 16928 KB Output is correct
3 Correct 50 ms 16732 KB Output is correct
4 Correct 85 ms 17492 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 566 ms 203676 KB Output is correct
2 Correct 557 ms 201552 KB Output is correct
3 Correct 562 ms 203676 KB Output is correct
4 Correct 567 ms 203680 KB Output is correct
5 Correct 573 ms 201628 KB Output is correct
6 Correct 45 ms 16732 KB Output is correct
7 Correct 54 ms 16732 KB Output is correct
8 Correct 49 ms 16924 KB Output is correct
9 Correct 72 ms 17488 KB Output is correct
10 Correct 17 ms 10844 KB Output is correct
11 Correct 17 ms 10876 KB Output is correct
12 Correct 69 ms 12384 KB Output is correct
13 Correct 18 ms 11100 KB Output is correct
14 Correct 17 ms 10844 KB Output is correct
15 Correct 1 ms 4444 KB Output is correct
16 Correct 1 ms 4444 KB Output is correct
17 Correct 1 ms 4440 KB Output is correct
18 Correct 5 ms 45404 KB Output is correct
19 Correct 7 ms 45576 KB Output is correct
20 Correct 5 ms 45604 KB Output is correct
21 Correct 5 ms 45404 KB Output is correct
22 Correct 5 ms 43356 KB Output is correct
23 Correct 5 ms 45404 KB Output is correct
24 Correct 6 ms 43352 KB Output is correct
25 Correct 57 ms 46340 KB Output is correct
26 Correct 5 ms 45400 KB Output is correct
27 Correct 2669 ms 203628 KB Output is correct
28 Execution timed out 20032 ms 212380 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 562 ms 203604 KB Output is correct
2 Correct 546 ms 201624 KB Output is correct
3 Correct 569 ms 203856 KB Output is correct
4 Correct 557 ms 203676 KB Output is correct
5 Correct 549 ms 201620 KB Output is correct
6 Correct 45 ms 16732 KB Output is correct
7 Correct 45 ms 16732 KB Output is correct
8 Correct 50 ms 16920 KB Output is correct
9 Correct 78 ms 17548 KB Output is correct
10 Correct 17 ms 10876 KB Output is correct
11 Correct 17 ms 10840 KB Output is correct
12 Correct 68 ms 12372 KB Output is correct
13 Correct 17 ms 10844 KB Output is correct
14 Correct 18 ms 10844 KB Output is correct
15 Runtime error 200 ms 35144 KB Execution killed with signal 6
16 Halted 0 ms 0 KB -