제출 #660280

#제출 시각UTC-0아이디문제언어결과실행 시간메모리
6602802022-11-21 13:05:12ivopavRaisins (IOI09_raisins)C++14
100 / 100
914 ms29388 KiB
#include <bits/stdc++.h>
using namespace std;
int sum(const vector<vector<int>>& mat2,int x1,int y1,int x2,int y2){
if (x1==0 && y1==0){
return mat2[y2][x2];
}
else if(x1==0){
return mat2[y2][x2]-mat2[y1-1][x2];
}
else if(y1==0){
return mat2[y2][x2]-mat2[y2][x1-1];
}
else{
return mat2[y2][x2]-mat2[y1-1][x2]-mat2[y2][x1-1]+mat2[y1-1][x1-1];
}
}
int rek(const vector<vector<int>>& mat,const vector<vector<int>>& mat2,vector<vector<vector<vector<int>>>>& mem,int x1,int y1,int x2,int y2){
if (x1==x2 && y1==y2){
return 0;
}
if (mem[x1][y1][x2][y2]!=-1){
return mem[x1][y1][x2][y2];
}
int najm=numeric_limits<int>::max();
for (int i=x1;i<x2;i++){
int pom=rek(mat,mat2,mem,x1,y1,i,y2);
int pom2=rek(mat,mat2,mem,i+1,y1,x2,y2);
najm=min(najm,pom+pom2);
 
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
#Verdict Execution timeMemoryGrader output
Fetching results...