# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
1023542 |
2024-07-15T00:47:51 Z |
vjudge1 |
Wombats (IOI13_wombats) |
C++17 |
|
11870 ms |
22304 KB |
#include "wombats.h"
#include<bits/stdc++.h>
using namespace std;
int tmp[100][100];
struct matrix{
int V[100][100];
void friend operator *=(matrix &a,matrix &b){
memcpy(tmp,a.V,sizeof tmp);
for(int i=0;i<100;i++)
for(int j=0;j<100;j++)
a.V[i][j]=1e9;
for(int i=0;i<100;i++)
for(int j=0;j<100;j++) for(int k=0;k<100;k++)
a.V[i][j]=min(a.V[i][j],tmp[i][k]+b.V[k][j]);
}
void reset(){
for(int i=0;i<100;i++)
memset(V[i],15,sizeof V[i]),V[i][i]=0;
}
} mygod[7],finalstuff;
int ans[100][100],lr[5000][100],dn[5000][100],col,row,SZ=720,blocknum;
void recalcblok(int blok){
mygod[blok].reset();
int end=min(row-1,SZ*blok+SZ);
for(int r=SZ*blok+1;r<=end;r++){
for(int i=0;i<col;i++) {
for(int j=0;j<col;j++)
mygod[blok].V[i][j]+=dn[r-1][j];
for(int j=0;++j<col;)
mygod[blok].V[i][j]=min(mygod[blok].V[i][j],
mygod[blok].V[i][j-1]+lr[r][j-1]);
for(int j=col;--j;)
mygod[blok].V[i][j-1]=min(mygod[blok].V[i][j-1],
mygod[blok].V[i][j]+lr[r][j-1]);
}
}
}
void redofinale(){
int pref[100]; memcpy(pref+1,lr,99*4);
for(int i=1;i<100;i++) pref[i]+=pref[i-1];
for(int i=0;i<col;i++) for(int j=0;j<col;j++)
finalstuff.V[i][j]=abs(pref[i]-pref[j]);
for(int i=0;i<=blocknum;i++)
finalstuff*=mygod[i];
}
void init(int R, int C, int H[5000][200], int V[5000][200]) {
for(int i=0;i<5000;i++)
memcpy(lr[i],H[i],sizeof lr[i]),
memcpy(dn[i],V[i],sizeof dn[i]);
row=R;col=C;
blocknum=(R-2)/SZ;
for(int i=0;i<=blocknum;i++)
recalcblok(i);
redofinale();
}
void changeH(int P, int Q, int W) {
lr[P][Q]=W;
if(P)recalcblok(P/SZ),redofinale();
}
void changeV(int P, int Q, int W) {
memset(ans,-1,sizeof ans);
dn[P][Q]=W;
recalcblok(P/SZ),redofinale();
}
void calcstuff(int strt){
int dp[100];
memset(dp,7,sizeof dp);
dp[strt]=0;
for(int i=strt;i--;)
dp[i]=dp[i+1]+lr[0][i];
for(int i=strt;++i<col;)
dp[i]=dp[i-1]+lr[0][i-1];
for(int i=1;i<row;i++){
for(int j=0;j<col;j++)
dp[j]+=dn[i-1][j];
for(int j=col;--j;)
dp[j-1]=min(dp[j-1],dp[j]+lr[i][j-1]);
for(int j=0;++j<col;)
dp[j]=min(dp[j],dp[j-1]+lr[i][j-1]);
}
memcpy(ans[strt],dp,sizeof dp);
}
int escape(int V1, int V2) {
return finalstuff.V[V1][V2];
}
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;
| ^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2466 ms |
10520 KB |
Output is correct |
2 |
Correct |
2422 ms |
10532 KB |
Output is correct |
3 |
Correct |
2409 ms |
13168 KB |
Output is correct |
4 |
Correct |
2431 ms |
10332 KB |
Output is correct |
5 |
Correct |
2369 ms |
10328 KB |
Output is correct |
6 |
Correct |
3 ms |
5980 KB |
Output is correct |
7 |
Correct |
2 ms |
5980 KB |
Output is correct |
8 |
Correct |
2 ms |
5992 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
3 ms |
5980 KB |
Output is correct |
2 |
Correct |
2 ms |
5980 KB |
Output is correct |
3 |
Correct |
2 ms |
5980 KB |
Output is correct |
4 |
Correct |
2 ms |
8028 KB |
Output is correct |
5 |
Correct |
2 ms |
7868 KB |
Output is correct |
6 |
Correct |
3 ms |
8028 KB |
Output is correct |
7 |
Correct |
3 ms |
8028 KB |
Output is correct |
8 |
Correct |
2 ms |
7876 KB |
Output is correct |
9 |
Correct |
3 ms |
8032 KB |
Output is correct |
10 |
Correct |
2 ms |
8036 KB |
Output is correct |
11 |
Correct |
41 ms |
10364 KB |
Output is correct |
12 |
Correct |
2 ms |
8032 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
328 ms |
8204 KB |
Output is correct |
2 |
Correct |
326 ms |
8032 KB |
Output is correct |
3 |
Correct |
322 ms |
8176 KB |
Output is correct |
4 |
Correct |
335 ms |
8212 KB |
Output is correct |
5 |
Correct |
328 ms |
8216 KB |
Output is correct |
6 |
Correct |
2 ms |
5980 KB |
Output is correct |
7 |
Correct |
3 ms |
5984 KB |
Output is correct |
8 |
Correct |
2 ms |
5984 KB |
Output is correct |
9 |
Correct |
1545 ms |
8204 KB |
Output is correct |
10 |
Correct |
4 ms |
8028 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2405 ms |
12616 KB |
Output is correct |
2 |
Correct |
2390 ms |
12380 KB |
Output is correct |
3 |
Correct |
2397 ms |
12636 KB |
Output is correct |
4 |
Correct |
2368 ms |
13864 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
322 ms |
8204 KB |
Output is correct |
2 |
Correct |
333 ms |
8028 KB |
Output is correct |
3 |
Correct |
326 ms |
8028 KB |
Output is correct |
4 |
Correct |
365 ms |
8024 KB |
Output is correct |
5 |
Correct |
336 ms |
8028 KB |
Output is correct |
6 |
Correct |
2393 ms |
12636 KB |
Output is correct |
7 |
Correct |
2443 ms |
12472 KB |
Output is correct |
8 |
Correct |
2474 ms |
12636 KB |
Output is correct |
9 |
Correct |
2368 ms |
13884 KB |
Output is correct |
10 |
Correct |
2315 ms |
10520 KB |
Output is correct |
11 |
Correct |
2487 ms |
10528 KB |
Output is correct |
12 |
Correct |
2413 ms |
13260 KB |
Output is correct |
13 |
Correct |
2361 ms |
10332 KB |
Output is correct |
14 |
Correct |
2263 ms |
10532 KB |
Output is correct |
15 |
Correct |
3 ms |
5980 KB |
Output is correct |
16 |
Correct |
3 ms |
5980 KB |
Output is correct |
17 |
Correct |
2 ms |
5848 KB |
Output is correct |
18 |
Correct |
4 ms |
8028 KB |
Output is correct |
19 |
Correct |
3 ms |
8028 KB |
Output is correct |
20 |
Correct |
3 ms |
8028 KB |
Output is correct |
21 |
Correct |
2 ms |
8028 KB |
Output is correct |
22 |
Correct |
3 ms |
8028 KB |
Output is correct |
23 |
Correct |
3 ms |
7872 KB |
Output is correct |
24 |
Correct |
3 ms |
8028 KB |
Output is correct |
25 |
Correct |
45 ms |
10192 KB |
Output is correct |
26 |
Correct |
4 ms |
8028 KB |
Output is correct |
27 |
Correct |
1476 ms |
8224 KB |
Output is correct |
28 |
Correct |
10870 ms |
16464 KB |
Output is correct |
29 |
Correct |
11117 ms |
16408 KB |
Output is correct |
30 |
Correct |
9755 ms |
16360 KB |
Output is correct |
31 |
Correct |
11870 ms |
18312 KB |
Output is correct |
32 |
Correct |
4 ms |
8024 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
328 ms |
8028 KB |
Output is correct |
2 |
Correct |
327 ms |
8196 KB |
Output is correct |
3 |
Correct |
337 ms |
8168 KB |
Output is correct |
4 |
Correct |
322 ms |
8028 KB |
Output is correct |
5 |
Correct |
323 ms |
8028 KB |
Output is correct |
6 |
Correct |
2373 ms |
12632 KB |
Output is correct |
7 |
Correct |
2352 ms |
12380 KB |
Output is correct |
8 |
Correct |
2337 ms |
12636 KB |
Output is correct |
9 |
Correct |
2380 ms |
13880 KB |
Output is correct |
10 |
Correct |
2361 ms |
10524 KB |
Output is correct |
11 |
Correct |
2322 ms |
10532 KB |
Output is correct |
12 |
Correct |
2456 ms |
13184 KB |
Output is correct |
13 |
Correct |
2343 ms |
10532 KB |
Output is correct |
14 |
Correct |
2479 ms |
10524 KB |
Output is correct |
15 |
Incorrect |
909 ms |
22304 KB |
Output isn't correct |
16 |
Halted |
0 ms |
0 KB |
- |