# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
12148 |
2014-12-21T10:33:43 Z |
gs13105 |
Min-cost GCD (GA9_mcg) |
C++ |
|
512 ms |
16724 KB |
#include <stdio.h>
int mem[2001][2001];
inline int mn(int a,int b)
{
return a<b?a:b;
}
int main()
{
int a,b,p,q,t,i,j,k;
scanf("%d",&t);
for(k=0;k<t;k++)
{
scanf("%d%d%d%d",&a,&b,&p,&q);
if(t>100&&k)
{
printf("%d\n",mem[a][b]);
continue;
}
for(j=1;j<=b;j++)
for(i=1;i<=a;i++)
mem[i][j]=mn(p+mem[j][i%j],q+(i>=j?mem[i-j][j]:mem[i][j-i]));
printf("%d\n",mem[a][b]);
}
return 0;
}
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
0 ms |
16724 KB |
Output is correct |
2 |
Incorrect |
0 ms |
16724 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
63 ms |
16724 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
0 ms |
16720 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Runtime error |
512 ms |
16720 KB |
SIGSEGV Segmentation fault |
2 |
Halted |
0 ms |
0 KB |
- |