Submission #764247

#TimeUsernameProblemLanguageResultExecution timeMemory
764247fatemetmhrWombats (IOI13_wombats)C++17
12 / 100
273 ms16248 KiB
// ~ Be Name Khoda ~ // #include "wombats.h" #include <bits/stdc++.h> //#pragma GCC optimize ("O3") //#pragma GCC target("avx2") //#pragma GCC optimize("unroll-loops,Ofast") using namespace std; typedef long long ll; #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define fi first #define se second const int maxn = 1e6 + 10; const int maxn5 = 5e5 + 10; const int maxnC = 205; const int maxnR = 5e3 + 5; const int mod = 1e9 + 7; const int inf = 1e9; int n, m; int dp[2][maxnR][maxnC]; int v[maxnR][maxnC], h[maxnR][maxnC]; inline void build(){ for(int i = 0; i < m; i++) for(int j = 0; j < m; j++) dp[1][i][j] = inf; for(int i = 0; i < m; i++) dp[1][i][i] = 0; for(int j = 0; j < n; j++) for(int x = 0; x < m; x++){ int mn = inf; for(int i = 0; i < m; i++){ dp[j & 1][x][i] = min(mn, dp[(j + 1) & 1][x][i] + (j ? v[j - 1][i] : 0)); mn = dp[j & 1][x][i] + h[j][i]; } mn = inf; for(int i = m - 1; i >= 0; i--){ dp[j & 1][x][i] = min(mn, dp[j & 1][x][i]); if(i) mn = dp[j & 1][x][i] + h[j][i - 1]; //cout << "check " << j << ' ' << x << ' ' << i << ' ' << dp[j & 1][x][i] << ' ' << mn << endl; } } } 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; j++){ h[i][j] = H[i][j]; v[i][j] = V[i][j]; } build(); } void changeH(int P, int Q, int W) { h[P][Q] = W; build(); } void changeV(int P, int Q, int W) { h[P][Q] = W; build(); } int escape(int v1, int v2){ return dp[(n - 1) & 1][v1][v2]; }

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;
      |      ^~~
#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...