Submission #248877

#TimeUsernameProblemLanguageResultExecution timeMemory
248877ryanseeWombats (IOI13_wombats)C++14
55 / 100
8909 ms262148 KiB
#include "wombats.h" #include "bits/stdc++.h" using namespace std; #define FAST ios_base::sync_with_stdio(false); cin.tie(0); #define pb push_back #define eb emplace_back #define ins insert #define f first #define s second #define cbr cerr<<"hi\n" #define mmst(x, v) memset((x), v, sizeof ((x))) #define siz(x) ll(x.size()) #define all(x) (x).begin(), (x).end() #define lbd(x,y) (lower_bound(all(x),y)-x.begin()) #define ubd(x,y) (upper_bound(all(x),y)-x.begin()) mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); //can be used by calling rng() or shuffle(A, A+n, rng) inline long long rand(long long x, long long y) { return rng() % (y+1-x) + x; } //inclusivesss string inline to_string(char c) {string s(1,c);return s;} template<typename T> inline T gcd(T a,T b){ return a==0?llabs(b):gcd(b%a,a); } using ll=int; using ld=long double; #define FOR(i,s,e) for(ll i=s;i<=ll(e);++i) #define DEC(i,s,e) for(ll i=s;i>=ll(e);--i) using pi=pair<ll,ll>; using spi=pair<ll,pi>; using dpi=pair<pi,pi>; // #define LLINF ((long long)1e18) #define INF int(1e9+1e6) #define MAXN (300006) ll n, M, H[5003][203], C[5003][203]; struct node { int s,e,m; ll dp[203][203]; node*l,*r; node(int S,int E){ s=S,e=E,m=(s+e)>>1; if(s^e) l=new node(s,m),r=new node(m+1,e), combine(l,r); else { FOR(i,0,M-1) FOR(j,i,M-1) if(i^j) dp[i][j]=dp[i][j-1]+H[s][j-1]; else dp[i][j]=0; FOR(i,0,M-1) FOR(j,0,i-1) dp[i][j]=dp[j][i]; } } void combine(node* l, node* r){ FOR(i,0,M-1)FOR(j,0,M-1){ dp[i][j]=INF; FOR(k,0,M-1) dp[i][j]=min(dp[i][j],l->dp[i][k]+r->dp[k][j]+C[m][k]); } } void update(int x){ if(s==e){ FOR(i,0,M-1) FOR(j,i,M-1) if(i^j) dp[i][j]=dp[i][j-1]+H[s][j-1]; else dp[i][j]=0; FOR(i,0,M-1) FOR(j,0,i-1) dp[i][j]=dp[j][i]; return; } if(x>m)r->update(x);else l->update(x); combine(l,r); } }*seg; void init(int _r, int _c, int HH[5000][200], int VV[5000][200]) { /* ... */ n=_r, M=_c; FOR(i,0,4999)FOR(j,0,199)H[i][j]=HH[i][j],C[i][j]=VV[i][j]; seg=new node(0, n-1); } void changeH(int P, int Q, int W) { /* ... */ H[P][Q]=W; seg->update(P); } void changeV(int P, int Q, int W) { /* ... */ C[P][Q]=W; seg->update(P+1); } int escape(int V1, int V2) { return seg->dp[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]
  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...