Submission #940507

#TimeUsernameProblemLanguageResultExecution timeMemory
940507vjudge1Wombats (IOI13_wombats)C++17
55 / 100
20089 ms262144 KiB
#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 (stderr)

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 timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...