Submission #3540

# Submission time Handle Problem Language Result Execution time Memory
3540 2013-08-31T06:28:16 Z BalloonCollector Hexagon travel (kriii1_H) C++
0 / 1
60 ms 7024 KB
#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
1 Correct 0 ms 1216 KB Output is correct
2 Correct 0 ms 1216 KB Output is correct
3 Correct 0 ms 1216 KB Output is correct
4 Correct 0 ms 1216 KB Output is correct
5 Incorrect 60 ms 7024 KB Output isn't correct
6 Halted 0 ms 0 KB -