# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
3540 | BalloonCollector | Hexagon travel (kriii1_H) | C++98 | 60 ms | 7024 KiB |
This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <cstdio>
#include <map>
using namespace std;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
map<iii,int> ma,mb,mc;
int main(){
int a,b,c;
scanf("%d %d %d",&a,&b,&c);
int to=a+b+c;
ma[iii(0,ii(0,0))]=0;
mb[iii(0,ii(0,0))]=1;
mc[iii(0,ii(0,0))]=0;
for(int i=0;i<to;i++){
for(int j=0;j<=i && j<=a;j++){
for(int k=0;j+k<=i && k<=b;k++){
if(i-j-k<=c){
ma[iii(j+1,ii(k,i-j-k))]+=ma[iii(j,ii(k,i-j-k))];
mb[iii(j+1,ii(k,i-j-k))]+=mb[iii(j,ii(k,i-j-k))];
mc[iii(j+1,ii(k,i-j-k))]+=mc[iii(j,ii(k,i-j-k))];
ma[iii(j,ii(k+1,i-j-k))]+=ma[iii(j,ii(k,i-j-k))];
mb[iii(j,ii(k+1,i-j-k))]+=mb[iii(j,ii(k,i-j-k))];
mc[iii(j,ii(k+1,i-j-k))]+=mc[iii(j,ii(k,i-j-k))];
if((j+k)%2==0){
ma[iii(j,ii(k,i-j-k+1))]+=mb[iii(j,ii(k,i-j-k))];
mb[iii(j,ii(k,i-j-k+1))]+=mc[iii(j,ii(k,i-j-k))];
mc[iii(j,ii(k,i-j-k+1))]+=ma[iii(j,ii(k,i-j-k))];
}else{
ma[iii(j,ii(k,i-j-k+1))]+=mc[iii(j,ii(k,i-j-k))];
mb[iii(j,ii(k,i-j-k+1))]+=ma[iii(j,ii(k,i-j-k))];
mc[iii(j,ii(k,i-j-k+1))]+=mb[iii(j,ii(k,i-j-k))];
}
}
}
}
}
printf("%d\n%d\n%d\n",ma[iii(a,ii(b,c))],mc[iii(a,ii(b,c))],mb[iii(a,ii(b,c))]);
}
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
Fetching results... |