Cody

Problem 1887. Graceful Graph: Wichmann Rulers

Solution 1833995

Submitted on 1 Jun 2019 by William
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 n=17; exp=101; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.014524 seconds.

2   Pass
n=19; exp=123; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.046309 seconds.

3   Pass
n=23; exp=183; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.067288 seconds.

4   Pass
n=29; exp=289; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.090324 seconds.

5   Pass
n=31; exp=327; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.112476 seconds.

6   Pass
n=37; exp=465; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.134515 seconds.

7   Pass
n=41; exp=573; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.156051 seconds.

8   Pass
n=43; exp=627; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.186744 seconds.

9   Pass
n=47; exp=751; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.215576 seconds.

10   Pass
n=53; exp=953; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.235727 seconds.

11   Pass
n=59; exp=1179; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.256065 seconds.

12   Pass
n=61; exp=1257; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.282523 seconds.

13   Pass
n=67; exp=1515; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.313030 seconds.

14   Pass
n=71; exp=1703; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.340906 seconds.

15   Pass
n=73; exp=1797; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.361909 seconds.

16   Pass
n=79; exp=2103; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.382191 seconds.

17   Pass
n=83; exp=2323; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.402123 seconds.

18   Pass
n=89; exp=2669; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.421738 seconds.

19   Pass
n=97; exp=3165; S=Graceful_Wichmann(n); assert(S(end)==exp) delta=abs(repmat(S,n,1)-repmat(S',1,n)); assert(length(unique(delta(:)))==S(end)+1) % zero increases delta unique toc

Elapsed time is 0.444729 seconds.

Suggested Problems

More from this Author246

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!