Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- G = zeros(5000,60);
- x = sort(importdata('input.txt'));
- for i=1:size(x,1)
- if strfind(x{i},'#')
- awake = true;
- ID = sscanf(x{i}(strfind(x{i},'#')+1:end),'%f');
- else
- G(ID,str2double(x{i}(16:17))+1:end) = G(ID,str2double(x{i}(16:17))+1:end)-1+2*awake;
- awake = ~awake;
- end
- end
- disp((find(max(G(find(max(sum(G,2))==sum(G,2)),:))==G(find(max(sum(G,2))==sum(G,2)),:))-1)*find(max(sum(G,2))==sum(G,2))) % Part 1
- disp((find(max(G(find(max(max(G,[],2))==max(G,[],2)),:))==G(find(max(max(G,[],2))==max(G,[],2)),:))-1)*find(max(max(G,[],2))==max(G,[],2))) % Part 2
Advertisement
Add Comment
Please, Sign In to add comment