Cody

# Problem 42779. GJam March 2016 IOW: Polynesiaglot Large

Solution 1688241

Submitted on 7 Dec 2018
This solution is locked. To view this solution, you need to provide a solution of the same size or smaller.

### Test Suite

Test Status Code Input and Output
1   Pass
tic % T 0.7 m=[1 1 4 ]; v=Polyglot(m); vexp=[5 ]; assert(isequal(vexp,v))

2   Pass
% T 0.8 m=[1 2 2 ]; v=Polyglot(m); vexp=[6 ]; assert(isequal(vexp,v))

3   Fail
% T Inf m=[43 47 500 ]; v=Polyglot(m); vexp=[671294715 ]; assert(isequal(vexp,v))

Assertion failed.

4   Fail
% T Inf m=[45 44 500 ]; v=Polyglot(m); vexp=[474858966 ]; assert(isequal(vexp,v))

Assertion failed.

5   Fail
% T 104.4 m=[1 1 500 ]; v=Polyglot(m); vexp=[523068127 ]; assert(isequal(vexp,v))

Assertion failed.

6   Pass
% T 0.3 m=[2 2 1 ]; v=Polyglot(m); vexp=[2 ]; assert(isequal(vexp,v))

7   Fail
% T Inf m=[48 41 500 ]; v=Polyglot(m); vexp=[356064865 ]; assert(isequal(vexp,v))

Assertion failed.

8   Pass
% T 1.6 m=[50 41 1 ]; v=Polyglot(m); vexp=[41 ]; assert(isequal(vexp,v))

9   Fail
% T Inf m=[41 40 500 ]; v=Polyglot(m); vexp=[396751820 ]; assert(isequal(vexp,v))

Assertion failed.

10   Fail
% T Inf m=[40 45 500 ]; v=Polyglot(m); vexp=[938256882 ]; assert(isequal(vexp,v))

Assertion failed.

11   Fail
% T Inf m=[46 44 500 ]; v=Polyglot(m); vexp=[883121986 ]; assert(isequal(vexp,v))

Assertion failed.

12   Fail
% T Inf m=[50 40 500 ]; v=Polyglot(m); vexp=[684068183 ]; assert(isequal(vexp,v))

Assertion failed.

13   Pass
% T 1.3 m=[4 3 2 ]; v=Polyglot(m); vexp=[21 ]; assert(isequal(vexp,v))

14   Fail
% T Inf m=[48 46 500 ]; v=Polyglot(m); vexp=[15068072 ]; assert(isequal(vexp,v))

Assertion failed.

15   Fail
% T Inf m=[46 47 500 ]; v=Polyglot(m); vexp=[483582780 ]; assert(isequal(vexp,v))

Assertion failed.

16   Fail
% T Inf m=[48 43 500 ]; v=Polyglot(m); vexp=[357963597 ]; assert(isequal(vexp,v))

Assertion failed.

17   Fail
% T Inf m=[40 50 500 ]; v=Polyglot(m); vexp=[722287557 ]; assert(isequal(vexp,v))

Assertion failed.

18   Fail
% T Inf m=[47 40 497 ]; v=Polyglot(m); vexp=[142264969 ]; assert(isequal(vexp,v))

Assertion failed.

19   Fail
% T Inf m=[42 45 500 ]; v=Polyglot(m); vexp=[300845428 ]; assert(isequal(vexp,v))

Assertion failed.

20   Fail
% T Inf m=[42 50 500 ]; v=Polyglot(m); vexp=[626241204 ]; assert(isequal(vexp,v))

Assertion failed.

21   Fail
% T Inf m=[50 50 499 ]; v=Polyglot(m); vexp=[244005114 ]; assert(isequal(vexp,v))

Assertion failed.

22   Pass
% T 3.1 m=[40 4 3 ]; v=Polyglot(m); vexp=[1344 ]; assert(isequal(vexp,v))

23   Pass
% T 1.6 m=[43 42 1 ]; v=Polyglot(m); vexp=[42 ]; assert(isequal(vexp,v))

24   Fail
% T Inf m=[44 49 500 ]; v=Polyglot(m); vexp=[518096485 ]; assert(isequal(vexp,v))

Assertion failed.

25   Fail
% T Inf m=[45 46 500 ]; v=Polyglot(m); vexp=[223782662 ]; assert(isequal(vexp,v))

Assertion failed.

26   Fail
% T Inf m=[49 40 500 ]; v=Polyglot(m); vexp=[678295851 ]; assert(isequal(vexp,v))

Assertion failed.

27   Pass
% T 2.2 m=[50 3 2 ]; v=Polyglot(m); vexp=[159 ]; assert(isequal(vexp,v))

28   Pass
% T 2.3 m=[48 4 2 ]; v=Polyglot(m); vexp=[208 ]; assert(isequal(vexp,v))

29   Fail
% T Inf m=[5 41 498 ]; v=Polyglot(m); vexp=[583339519 ]; assert(isequal(vexp,v))

Assertion failed.

30   Pass
% T 3.3 m=[3 43 2 ]; v=Polyglot(m); vexp=[1978 ]; assert(isequal(vexp,v))

31   Fail
% T Inf m=[41 49 500 ]; v=Polyglot(m); vexp=[707985113 ]; assert(isequal(vexp,v))

Assertion failed.

32   Fail
% T Inf m=[46 43 500 ]; v=Polyglot(m); vexp=[254325944 ]; assert(isequal(vexp,v))

Assertion failed.

33   Pass
% T 0.0 m=[2 1 1 ]; v=Polyglot(m); vexp=[1 ]; assert(isequal(vexp,v))

34   Fail
% T Inf m=[5 5 499 ]; v=Polyglot(m); vexp=[167403707 ]; assert(isequal(vexp,v))

Assertion failed.

35   Fail
% T Inf m=[48 40 500 ]; v=Polyglot(m); vexp=[687213242 ]; assert(isequal(vexp,v))

Assertion failed.

36   Pass
% T 1.7 m=[43 46 1 ]; v=Polyglot(m); vexp=[46 ]; assert(isequal(vexp,v))

37   Fail
% T Inf m=[43 4 498 ]; v=Polyglot(m); vexp=[127737869 ]; assert(isequal(vexp,v))

Assertion failed.

38   Fail
% T Inf m=[44 47 498 ]; v=Polyglot(m); vexp=[809685798 ]; assert(isequal(vexp,v))

Assertion failed.

39   Fail
% T Inf m=[41 50 500 ]; v=Polyglot(m); vexp=[701760607 ]; assert(isequal(vexp,v))

Assertion failed.

40   Fail
% T Inf m=[40 48 500 ]; v=Polyglot(m); vexp=[783408764 ]; assert(isequal(vexp,v))

Assertion failed.

41   Fail
% T Inf m=[3 40 499 ]; v=Polyglot(m); vexp=[158384704 ]; assert(isequal(vexp,v))

Assertion failed.

42   Fail
% T Inf m=[50 48 500 ]; v=Polyglot(m); vexp=[198880135 ]; assert(isequal(vexp,v))

Assertion failed.

43   Fail
% T Inf m=[49 44 497 ]; v=Polyglot(m); vexp=[539871481 ]; assert(isequal(vexp,v))

Assertion failed.

44   Fail
% T Inf m=[44 42 500 ]; v=Polyglot(m); vexp=[227201453 ]; assert(isequal(vexp,v))

Assertion failed.

45   Fail
% T Inf m=[41 47 500 ]; v=Polyglot(m); vexp=[212311056 ]; assert(isequal(vexp,v))

Assertion failed.

46   Fail
% T 254.9 m=[2 2 500 ]; v=Polyglot(m); vexp=[667073398 ]; assert(isequal(vexp,v))

Assertion failed.

47   Fail
% T Inf m=[45 50 500 ]; v=Polyglot(m); vexp=[556413734 ]; assert(isequal(vexp,v))

Assertion failed.

48   Pass
% T 5.3 m=[46 40 3 ]; v=Polyglot(m); vexp=[211200 ]; assert(isequal(vexp,v))

49   Fail
% T Inf m=[45 4 499 ]; v=Polyglot(m); vexp=[334760532 ]; assert(isequal(vexp,v))

Assertion failed.

50   Fail
% T Inf m=[40 43 500 ]; v=Polyglot(m); vexp=[328797447 ]; assert(isequal(vexp,v))

Assertion failed.

51   Fail
% T Inf m=[50 45 500 ]; v=Polyglot(m); vexp=[225964115 ]; assert(isequal(vexp,v))

Assertion failed.

52   Fail
% T Inf m=[49 42 500 ]; v=Polyglot(m); vexp=[690707538 ]; assert(isequal(vexp,v))

Assertion failed.

53   Fail
% T Inf m=[40 46 500 ]; v=Polyglot(m); vexp=[195330871 ]; assert(isequal(vexp,v))

Assertion failed.

54   Pass
% T 1.6 m=[5 4 2 ]; v=Polyglot(m); vexp=[36 ]; assert(isequal(vexp,v))

55   Fail
% T Inf m=[42 49 500 ]; v=Polyglot(m); vexp=[188049811 ]; assert(isequal(vexp,v))

Assertion failed.

56   Pass
% T 0.0 m=[1 1 1 ]; v=Polyglot(m); vexp=[1 ]; assert(isequal(vexp,v))

57   Fail
% T 218.1 m=[1 2 500 ]; v=Polyglot(m); vexp=[696656237 ]; assert(isequal(vexp,v))

Assertion failed.

58   Fail
% T Inf m=[42 40 500 ]; v=Polyglot(m); vexp=[922192442 ]; assert(isequal(vexp,v))

Assertion failed.

59   Fail
% T Inf m=[49 45 500 ]; v=Polyglot(m); vexp=[763469125 ]; assert(isequal(vexp,v))

Assertion failed.

60   Fail
% T Inf m=[50 42 500 ]; v=Polyglot(m); vexp=[328920270 ]; assert(isequal(vexp,v))

Assertion failed.

61   Fail
% T 150.3 m=[2 1 500 ]; v=Polyglot(m); vexp=[260322005 ]; assert(isequal(vexp,v))

Assertion failed.

62   Pass
% T 3.4 m=[5 49 2 ]; v=Polyglot(m); vexp=[2646 ]; assert(isequal(vexp,v))

63   Fail
% T Inf m=[47 47 500 ]; v=Polyglot(m); vexp=[237431455 ]; assert(isequal(vexp,v))

Assertion failed.

64   Fail
% T Inf m=[40 40 500 ]; v=Polyglot(m); vexp=[29203332 ]; assert(isequal(vexp,v))

Assertion failed.

65   Fail
% T Inf m=[43 41 500 ]; v=Polyglot(m); vexp=[376005947 ]; assert(isequal(vexp,v))

Assertion failed.

66   Fail
% T Inf m=[50 47 500 ]; v=Polyglot(m); vexp=[378681068 ]; assert(isequal(vexp,v))

Assertion failed.

67   Fail
% T Inf m=[47 50 500 ]; v=Polyglot(m); vexp=[795014271 ]; assert(isequal(vexp,v))

Assertion failed.

68   Pass
% T 1.6 m=[42 44 1 ]; v=Polyglot(m); vexp=[44 ]; assert(isequal(vexp,v))

69   Fail
% T Inf m=[40 41 500 ]; v=Polyglot(m); vexp=[506257932 ]; assert(isequal(vexp,v))

Assertion failed.

70   Fail
% T Inf m=[5 4 497 ]; v=Polyglot(m); vexp=[272829097 ]; assert(isequal(vexp,v))

Assertion failed.

71   Pass
% T 1.7 m=[50 50 1 ]; v=Polyglot(m); vexp=[50 ]; assert(isequal(vexp,v))

72   Pass
% T 3.7 m=[50 50 2 ]; v=Polyglot(m); vexp=[5000 ]; assert(isequal(vexp,v))

73   Fail
% T Inf m=[43 44 500 ]; v=Polyglot(m); vexp=[607981550 ]; assert(isequal(vexp,v))

Assertion failed.

74   Fail
% T Inf m=[50 49 500 ]; v=Polyglot(m); vexp=[267081842 ]; assert(isequal(vexp,v))

Assertion failed.

75   Fail
% T Inf m=[48 44 500 ]; v=Polyglot(m); vexp=[612852205 ]; assert(isequal(vexp,v))

Assertion failed.

76   Fail
% T Inf m=[45 48 500 ]; v=Polyglot(m); vexp=[652373815 ]; assert(isequal(vexp,v))

Assertion failed.

77   Fail
% T Inf m=[5 5 497 ]; v=Polyglot(m); vexp=[336290141 ]; assert(isequal(vexp,v))

Assertion failed.

78   Fail
% T Inf m=[41 42 500 ]; v=Polyglot(m); vexp=[50517743 ]; assert(isequal(vexp,v))

Assertion failed.

79   Fail
% T Inf m=[46 46 500 ]; v=Polyglot(m); vexp=[251353420 ]; assert(isequal(vexp,v))

Assertion failed.

80   Fail
% T Inf m=[45 49 500 ]; v=Polyglot(m); vexp=[66724508 ]; assert(isequal(vexp,v))

Assertion failed.

81   Fail
% T Inf m=[50 44 500 ]; v=Polyglot(m); vexp=[390526622 ]; assert(isequal(vexp,v))

Assertion failed.

82   Fail
% T Inf m=[45 47 500 ]; v=Polyglot(m); vexp=[37814577 ]; assert(isequal(vexp,v))

Assertion failed.

83   Fail
% T Inf m=[47 49 500 ]; v=Polyglot(m); vexp=[923599754 ]; assert(isequal(vexp,v))

Assertion failed.

84   Fail
% T Inf m=[44 48 500 ]; v=Polyglot(m); vexp=[872350727 ]; assert(isequal(vexp,v))

Assertion failed.

85   Fail
% T Inf m=[43 50 500 ]; v=Polyglot(m); vexp=[668567771 ]; assert(isequal(vexp,v))

Assertion failed.

86   Fail
% T Inf m=[41 4 498 ]; v=Polyglot(m); vexp=[111334900 ]; assert(isequal(vexp,v))

Assertion failed.

87   Pass
% T 3.6 m=[43 45 2 ]; v=Polyglot(m); vexp=[3960 ]; assert(isequal(vexp,v))

88   Pass
% T 1.7 m=[4 5 2 ]; v=Polyglot(m); vexp=[45 ]; assert(isequal(vexp,v))

89   Fail
% T Inf m=[40 49 500 ]; v=Polyglot(m); vexp=[281852157 ]; assert(isequal(vexp,v))

Assertion failed.

90   Fail
% T Inf m=[43 48 500 ]; v=Polyglot(m); vexp=[884129281 ]; assert(isequal(vexp,v))

Assertion failed.

91   Fail
% T Inf m=[41 48 500 ]; v=Polyglot(m); vexp=[216141546 ]; assert(isequal(vexp,v))

Assertion failed.

92   Fail
% T Inf m=[40 42 500 ]; v=Polyglot(m); vexp=[488528258 ]; assert(isequal(vexp,v))

Assertion failed.

93   Pass
% T 3.3 m=[5 42 2 ]; v=Polyglot(m); vexp=[1974 ]; assert(isequal(vexp,v))

94   Pass
% T 1.7 m=[45 45 1 ]; v=Polyglot(m); vexp=[45 ]; assert(isequal(vexp,v))

95   Fail
% T Inf m=[46 48 500 ]; v=Polyglot(m); vexp=[190132182 ]; assert(isequal(vexp,v))

Assertion failed.

96   Pass
% T 0.3 m=[1 2 1 ]; v=Polyglot(m); vexp=[2 ]; assert(isequal(vexp,v))

97   Pass
% T 3.6 m=[47 42 2 ]; v=Polyglot(m); vexp=[3738 ]; assert(isequal(vexp,v))

98   Fail
% T Inf m=[4 45 499 ]; v=Polyglot(m); vexp=[999945335 ]; assert(isequal(vexp,v))

Assertion failed.

99   Fail
% T Inf m=[44 40 500 ]; v=Polyglot(m); vexp=[53296911 ]; assert(isequal(vexp,v))

Assertion failed.

100   Fail
% T Inf m=[50 50 500 ]; v=Polyglot(m); vexp=[3178118 ]; assert(isequal(vexp,v)) toc

Assertion failed.

101   Pass
% Stacy992 March 12, 2016 % import java.util.*; % public class c { % public static long[][] memo; % public static long mod = 1000000007; % public static int c, v, l; % public static void main(String[] args){ % Scanner in = new Scanner(System.in); % int t = in.nextInt(); % for(int z = 1;z<=t;z++){ % c = in.nextInt(); % v = in.nextInt(); % l = in.nextInt(); % memo = new long[2][l]; % for(int i = 0;i<2;i++){ % Arrays.fill(memo[i], -1); % } % % System.out.println("Case #"+z+": "+go(0, 0)); % } % } % public static long go(int flag, int pos){ % if(pos == l){ % if(flag == 1){ % return 0; % } % return 1; % } % % if(memo[flag][pos] != -1){ % return memo[flag][pos]; % } % % long ans = 0; % ans = (ans+(go(0, pos+1)*v))%mod; % if(flag != 1){ % ans = (ans+(go(1, pos+1)*c))%mod; % } % return memo[flag][pos] = ans; % } % }