Submission #383574

#TimeUsernameProblemLanguageResultExecution timeMemory
383574KeshiWombats (IOI13_wombats)C++17
55 / 100
20097 ms17332 KiB
//In the name of God #include <bits/stdc++.h> #include "wombats.h" using namespace std; typedef int ll; typedef pair<ll, ll> pll; const ll maxn = 5010; const ll maxm = 210; const ll mod = 1e9 + 7; const ll inf = 1e9; #define fast_io ios::sync_with_stdio(false);cin.tie(0);cout.tie(0); #define file_io freopen("input.txt", "r+", stdin);freopen("output.txt", "w+", stdout); #define pb push_back #define Mp make_pair #define F first #define S second #define Sz(x) ll((x).size()) #define all(x) (x).begin(), (x).end() ll r, c; ll h[maxn][maxm], v[maxn][maxm]; ll dis[maxm][maxm], dl[maxm], dr[maxm]; void solve(){ for(ll i = 0; i < c; i++){ fill(dis[i], dis[i] + c, inf); dis[i][i] = 0; for(ll o = 0; o < r; o++){ for(ll j = 0; j < c; j++){ dl[j] = dis[i][j]; if(j) dl[j] = min(dl[j], dl[j - 1] + h[o][j - 1]); } for(ll j = c; j--;){ dr[j] = dis[i][j]; if(j + 1 < c) dr[j] = min(dr[j], dr[j + 1] + h[o][j]); } for(ll j = 0; j < c; j++){ dis[i][j] = min(dl[j], dr[j]) + v[o][j]; } } } } void init(int R, int C, int H[5000][200], int V[5000][200]) { r = R; c = C; for(ll i = 0; i < r; i++){ for(ll j = 0; j < c - 1; j++){ h[i][j] = H[i][j]; } } for(ll i = 0; i < r - 1; i++){ for(ll j = 0; j < c; j++){ v[i][j] = V[i][j]; } } solve(); } void changeH(int P, int Q, int W) { h[P][Q] = W; solve(); } void changeV(int P, int Q, int W) { v[P][Q] = W; solve(); } int escape(int V1, int V2) { return dis[V1][V2]; } /*int main(){ fast_io; cin >> r >> c; for(ll i = 0; i < r; i++){ for(ll j = 0; j < c - 1; j++){ cin >> h[i][j]; } } for(ll i = 0; i < r - 1; i++){ for(ll j = 0; j < c; j++){ cin >> v[i][j]; } } solve(); cout << escape(2, 1) << "\n"; cout << escape(3, 3) << "\n"; changeV(0,0,5); changeH(1,1,6); cout << escape(2, 1) << "\n"; return 0; }*/

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...