Submission #940507

# Submission time Handle Problem Language Result Execution time Memory
940507 2024-03-07T10:06:55 Z vjudge1 Wombats (IOI13_wombats) C++17
55 / 100
20000 ms 262144 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=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[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")
      |
# Verdict Execution time Memory Grader output
1 Correct 16 ms 10844 KB Output is correct
2 Correct 17 ms 10844 KB Output is correct
3 Correct 72 ms 12312 KB Output is correct
4 Correct 17 ms 10844 KB Output is correct
5 Correct 17 ms 10844 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 4696 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 4440 KB Output is correct
2 Correct 1 ms 4444 KB Output is correct
3 Correct 1 ms 4444 KB Output is correct
4 Correct 8 ms 45560 KB Output is correct
5 Correct 5 ms 45404 KB Output is correct
6 Correct 6 ms 45404 KB Output is correct
7 Correct 5 ms 45404 KB Output is correct
8 Correct 5 ms 43356 KB Output is correct
9 Correct 7 ms 45584 KB Output is correct
10 Correct 5 ms 43356 KB Output is correct
11 Correct 58 ms 46424 KB Output is correct
12 Correct 6 ms 45400 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 560 ms 199924 KB Output is correct
2 Correct 540 ms 201624 KB Output is correct
3 Correct 565 ms 201548 KB Output is correct
4 Correct 569 ms 201552 KB Output is correct
5 Correct 544 ms 199512 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
9 Correct 2710 ms 199668 KB Output is correct
10 Correct 2 ms 12632 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 45 ms 16732 KB Output is correct
2 Correct 47 ms 16728 KB Output is correct
3 Correct 47 ms 16732 KB Output is correct
4 Correct 74 ms 17532 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 556 ms 197656 KB Output is correct
2 Correct 545 ms 197612 KB Output is correct
3 Correct 554 ms 199664 KB Output is correct
4 Correct 557 ms 197460 KB Output is correct
5 Correct 560 ms 197620 KB Output is correct
6 Correct 45 ms 16728 KB Output is correct
7 Correct 46 ms 16728 KB Output is correct
8 Correct 46 ms 16924 KB Output is correct
9 Correct 88 ms 17688 KB Output is correct
10 Correct 17 ms 10844 KB Output is correct
11 Correct 17 ms 10844 KB Output is correct
12 Correct 69 ms 12372 KB Output is correct
13 Correct 17 ms 10844 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 4444 KB Output is correct
18 Correct 6 ms 45548 KB Output is correct
19 Correct 5 ms 45404 KB Output is correct
20 Correct 6 ms 45548 KB Output is correct
21 Correct 7 ms 45404 KB Output is correct
22 Correct 5 ms 43356 KB Output is correct
23 Correct 6 ms 45400 KB Output is correct
24 Correct 5 ms 43356 KB Output is correct
25 Correct 59 ms 46448 KB Output is correct
26 Correct 6 ms 45400 KB Output is correct
27 Correct 2670 ms 199664 KB Output is correct
28 Execution timed out 20089 ms 210216 KB Time limit exceeded
29 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 555 ms 203672 KB Output is correct
2 Correct 544 ms 201464 KB Output is correct
3 Correct 558 ms 203676 KB Output is correct
4 Correct 565 ms 203856 KB Output is correct
5 Correct 552 ms 201624 KB Output is correct
6 Correct 45 ms 16732 KB Output is correct
7 Correct 45 ms 16732 KB Output is correct
8 Correct 47 ms 16732 KB Output is correct
9 Correct 72 ms 17488 KB Output is correct
10 Correct 17 ms 10840 KB Output is correct
11 Correct 17 ms 10844 KB Output is correct
12 Correct 69 ms 12368 KB Output is correct
13 Correct 16 ms 10844 KB Output is correct
14 Correct 17 ms 10844 KB Output is correct
15 Runtime error 2815 ms 262144 KB Execution killed with signal 9
16 Halted 0 ms 0 KB -