Solve day 3
This commit is contained in:
parent
2fbada26bf
commit
6c80df7b20
76
src/day03.zig
Normal file
76
src/day03.zig
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
const std = @import("std");
|
||||||
|
|
||||||
|
pub const input = @embedFile("input/day03.txt");
|
||||||
|
const test_input = @embedFile("input/day03_test1.txt");
|
||||||
|
|
||||||
|
fn ascii_to_priority(char: u8) error{InvalidChar}!u8 {
|
||||||
|
if (char >= 97 and char <= 122) {
|
||||||
|
return char - 96;
|
||||||
|
} else if (char >= 65 and char <= 90) {
|
||||||
|
return char - 64 + 26;
|
||||||
|
} else {
|
||||||
|
return error.InvalidChar;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const PrioritySet = std.StaticBitSet(26 * 2 + 1);
|
||||||
|
|
||||||
|
pub fn solve_part1(data: []const u8) !usize {
|
||||||
|
var lines = std.mem.split(u8, data, "\n");
|
||||||
|
var sum: usize = 0;
|
||||||
|
while (lines.next()) |line| {
|
||||||
|
if (std.mem.eql(u8, line, "")) break;
|
||||||
|
var compartment1 = PrioritySet.initEmpty();
|
||||||
|
var compartment2 = PrioritySet.initEmpty();
|
||||||
|
var i: usize = 0;
|
||||||
|
while (i < line.len) : (i += 1) {
|
||||||
|
const priority = try ascii_to_priority(line[i]);
|
||||||
|
if (i < line.len / 2) {
|
||||||
|
compartment1.set(priority);
|
||||||
|
} else {
|
||||||
|
compartment2.set(priority);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
compartment1.setIntersection(compartment2);
|
||||||
|
sum += compartment1.findFirstSet().?;
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn solve_part2(data: []const u8) !usize {
|
||||||
|
var lines = std.mem.split(u8, data, "\n");
|
||||||
|
var sum: usize = 0;
|
||||||
|
var i: usize = 0;
|
||||||
|
var group = [3]PrioritySet{ PrioritySet.initEmpty(), PrioritySet.initEmpty(), PrioritySet.initEmpty() };
|
||||||
|
while (i < 3) {
|
||||||
|
const line = lines.next().?;
|
||||||
|
if (std.mem.eql(u8, line, "")) break;
|
||||||
|
|
||||||
|
var j: usize = 0;
|
||||||
|
while (j < line.len) : (j += 1) {
|
||||||
|
group[i].set(try ascii_to_priority(line[j]));
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i == 2) {
|
||||||
|
group[0].setIntersection(group[1]);
|
||||||
|
group[0].setIntersection(group[2]);
|
||||||
|
const priority = group[0].findFirstSet().?;
|
||||||
|
sum += priority;
|
||||||
|
|
||||||
|
i = 0;
|
||||||
|
group = [3]PrioritySet{ PrioritySet.initEmpty(), PrioritySet.initEmpty(), PrioritySet.initEmpty() };
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
i += 1;
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
|
test "solves part1" {
|
||||||
|
try std.testing.expectEqual(solve_part1(test_input), 157);
|
||||||
|
}
|
||||||
|
|
||||||
|
test "solves part2" {
|
||||||
|
try std.testing.expectEqual(solve_part2(test_input), 70);
|
||||||
|
}
|
300
src/input/day03.txt
Normal file
300
src/input/day03.txt
Normal file
@ -0,0 +1,300 @@
|
|||||||
|
QJRBMDMtRDCtJzBtJMfjNjhwvmNDvwjLVVgh
|
||||||
|
TPSNNPZGTjgmSmvfjL
|
||||||
|
bPlpZZbpsTlTsWprpGFCJtRtzMNdMMBBcWnJQB
|
||||||
|
tppvbQBhpQQdrzMMcLwhMc
|
||||||
|
gZnWRccRNgFGRGRFRNNgZgJMddddLLLMCPqwLCNPwqPJ
|
||||||
|
nRRmFSnWmlgZlTlTllSlSWWWTsfvfDQpBfBcpQvpVQpTfQQf
|
||||||
|
lRlsVFgTlMgRNsSNTlFgmbWnMPppPnMqWZMWPPWW
|
||||||
|
fDjgBJdCfCHHBnfLWpqnmnpZmf
|
||||||
|
GjQHHcdvJHQBHSSNsFQFslwwRg
|
||||||
|
NPwDLDHNwjLLHWjbdSbDfJJQTZsZDS
|
||||||
|
BcFBcvgFvghnFLrBpvrgcgrJSZJpQdfSTZbCsSdfZZfbCf
|
||||||
|
VrngVFRmrVWHLGVMlL
|
||||||
|
SNBBBDlfZDLqNGmgFjjmBsQgCFtF
|
||||||
|
VPPVbhpbhMhRhncnScRncbrQtCgQQFmjjjsgtRtQHmFQ
|
||||||
|
nhWcPJVhpbvMvwvwllvSlGlD
|
||||||
|
wNlNNqtqHHHPhqCz
|
||||||
|
MMMMcQSWSpQCWFnRRPchLVvPLLzhmhLzhh
|
||||||
|
CrgRSWrnrQpppRQrCTnRTRtGtBDBfbNBllbTJlZtfNBN
|
||||||
|
QNbbNrnNnCwHmNPQmzqQNPsCCfBFFGtsBBddBDtCJDJd
|
||||||
|
gvVgpZWgTWvRvlvLPDDJjGBfdsdpDDJGdd
|
||||||
|
ZRMWWRMVgRZghTggPSMZzQwwnqwmnzhNnNwHcQHm
|
||||||
|
VmPHzBmpmQHbVHSpNHBVQCtRPPCPvFFMqqntZCZqMR
|
||||||
|
dWlDcfcfcjcfDWjlsZfjJhdGvFLGnLsLqsRnvRvRGGRttC
|
||||||
|
wfJhZTllcfdZdfjJfjdmQzHVSzHzgHQTpHpmpV
|
||||||
|
qNnqmzmCBfvmDvBm
|
||||||
|
HcdhtQdttbbhtVcrVVDMfZvdMBTqsWZMBsWZ
|
||||||
|
HQGtctRblwqpNwRN
|
||||||
|
SBtBLBMZzPDDNFFDQnVVVnnDmf
|
||||||
|
dgCjblRdgRvrbwjJGzQQQzwJVJ
|
||||||
|
WpWbCWWvlgrcCHdvvCdvWbSLZzhhZhtLBPPStSPhMSpM
|
||||||
|
PlPnGGGzCqqlrqTRsbTmFRWgDPmR
|
||||||
|
wwpLtjwpzjDwFWRsWTWW
|
||||||
|
NZtJjHNNhHfnCBcJMBlCSz
|
||||||
|
wSrwggPrhJhCdddw
|
||||||
|
tLMNvMTFhDZdhTBh
|
||||||
|
LtMvFttGbNcWRsLFLsccRRgfnSrPjPnfljSfPWlnPhrS
|
||||||
|
TSZlwZSSccSHZLHVcllSvmDLmJhjDDffJmGjQjgQQJ
|
||||||
|
sdBdzsNnBMBstNNMFhNPNbPzgGfDgJrtrfjCjDrCfJmmDQJf
|
||||||
|
BnnBznRsFRFBsspzzbZpSTqVTpHVhpTvlqVW
|
||||||
|
VtVjjhdFmCCfhRRzzSDbDzpmgzmvgb
|
||||||
|
CHJqrswsWvbvJbpD
|
||||||
|
CqCPcZHGHTcsCBQsBrTGHMFnLVQjMjLVVhdhnFQVRL
|
||||||
|
tvlPSrlNNvtglTtPccldQdhbQbZdcqqZ
|
||||||
|
mRmBGHWmDFRsZqHrfbdhqhZZ
|
||||||
|
jjMGjWrJpttNjtgg
|
||||||
|
HPtCMJNjvJLMDZRdBgLSBSfsWBgG
|
||||||
|
VmnrhwwqhbbzrwnDrqpdWBgfdSdfBGgffGWRdh
|
||||||
|
qmnTFbVnpqVzpnvlDFJZDClNZPZN
|
||||||
|
NNRFQfzbNWhLHTVh
|
||||||
|
dGjptnrPqgvqjccvndnnPPhlHrVVTHLWMHlwmrlHMmVTWm
|
||||||
|
tDggGnPqDcPPpPpddjGhggtJCCSssfJbQsDfbZsbsbRZFQ
|
||||||
|
bqZWhbvvvqfvhqvQCChhZlllGwlwGjNRrNGrwGwNRQ
|
||||||
|
PmspSscJVJStzSVzWJlgwlwNlGRLDGrPgNwN
|
||||||
|
pdHmWMVStWJWFBBCCbMhCfbC
|
||||||
|
wtwbctGLwGWhGwfWwhNrnLrlrQFNmPNNVrrl
|
||||||
|
CSdqZRsMStdJMMSZqPnFmVqPQlnjNjqj
|
||||||
|
TMtsTBSSRZBCJStMJSZTHtfvpgvzzWwhbpwhggbzHpbW
|
||||||
|
HncMbCwCncHlcbMDMnMFGsNsJVFJGchVTTcmcG
|
||||||
|
RRfBRNjRLLJTLTThsq
|
||||||
|
zpBRjWRrRvBpNtRWrgwbrwQPDPMDwCnn
|
||||||
|
TDcPLTVRjntFwDwDnb
|
||||||
|
SJJhffHqHZZgHGSFFbdrGTGnGv
|
||||||
|
NQHWZgJQHNHgHQhlLLLBjpRTjLjMNNLM
|
||||||
|
sMNnNRNrlGlsZBrGsrFQpclWlWLfpWjtzTfDtpzj
|
||||||
|
gvhPgwTgdSHtHDtpDPLp
|
||||||
|
gwhSwdvTSTbSgRrZNrrNFFNBGb
|
||||||
|
rtZnDHJrrDtGtGHvGHDWfdfwCjcBhjBCffwwLv
|
||||||
|
lzVlzsTRsmzVNTspVsMMsmwCLcmjmcdbBBChwfBbCW
|
||||||
|
sVTMpTpppsVMsPRPVzMNFqMFwZtQrHZDGqgHZrSQQrQQJDGn
|
||||||
|
wGQQMMQvCTPPQnHPBS
|
||||||
|
FsWdJddszWrrRRJRTmRmpppRHBNPBppNHp
|
||||||
|
rWdFWlFJzbzzMTwcvvMbGMgc
|
||||||
|
WTnnTpqSnCLmjGgSgjztgg
|
||||||
|
rQRHQvbNLwrgtGtrmDglJt
|
||||||
|
PwHRNvQPsvHvPTTpLTcCLVnq
|
||||||
|
qTsqJDJHjjfMCSDj
|
||||||
|
RnGGNFGznzGVnBCWmfSMSLwWRwSj
|
||||||
|
NnBbVQFVCClctHQc
|
||||||
|
BHzmfDHfJLGcQBGgQLDcstNttlZgdlltldshgZZg
|
||||||
|
PwPPSJwPvSNZlvSl
|
||||||
|
CJwwjnJFFnWRMcMzcHMHRzGL
|
||||||
|
rmZpvcZcqccsqmqzzzcBRLBZbBBRLBlRGVdfZR
|
||||||
|
PwjFggwMDgNFwPgTwNFgtFJjfGLhBLsGRGbfBfBLbbTVLbdf
|
||||||
|
DWJwgDWMJJDWCCNHmrnscmqqcnpWSQ
|
||||||
|
bsRlVgMhtzHvhRvpzcLSZcTWLGzTTrGc
|
||||||
|
QJnDjmqjJdmDqqrGWWsZsZTc
|
||||||
|
nQPsnwCJdBDJDDJvhHhpMRCVlhlgRV
|
||||||
|
NBNwMCtNgqCHClHClq
|
||||||
|
JpQmFrQQfHfWjJTfLTjfLRRFRvnvhvnDGDcRcvVGGV
|
||||||
|
HTzzpzzdHgbBZZtdMB
|
||||||
|
SWcVvBFBVBjShWhGQtZnHFDHRGGQsR
|
||||||
|
pMZpmmJPbwbTTQttrDrRrttT
|
||||||
|
mZflqdlbMVcNjdWLSj
|
||||||
|
tvjdccdbLjhvhlcjRMvRTCQJmBPBCFRG
|
||||||
|
qgnqZfHpZDVnCpZzZJQFQBgmmPFJBmRQJQ
|
||||||
|
SHDZDDzpNVpfsNsHqpDSjLwCbbWLChwtwjtCWc
|
||||||
|
FsWTbcwmGfFFFrpl
|
||||||
|
LMhzdfqjLdHQQnSvldGvnS
|
||||||
|
VZjVNzfNLtjzDMhVDNtqDqwJwRmmmZJgmgcbWgRRwCbJ
|
||||||
|
ZJbPwwfJcGlwCrrZrMMddMMMtt
|
||||||
|
pTNvvSSHmmnbpFRp
|
||||||
|
SLSjSLDSQNLHNDbJbcfJclBzjGsz
|
||||||
|
WSQCWQWstCWCCgNNsDCZMZDBjjlLPnHMMLPrHlcrcLHHTjTh
|
||||||
|
bVFJFwfdRFFgjTPgnc
|
||||||
|
GmzRRqvRddbdRRdfJRJfsqsSSsZDsDBQZtCSgpgt
|
||||||
|
FPjprPpPCCFpFPHWsWvqnnllQsdLQMMlLtslLQMc
|
||||||
|
wmzJgzRSRRJghBbwGBBSbtGfLfGlcNnlltdddQtrMd
|
||||||
|
zDmRBmwDrpVFDTVDVp
|
||||||
|
FPGqjsZGlDJmzsHcTcTMMs
|
||||||
|
SQNLSvdbvVbrSbHcftGcrpHGfMmf
|
||||||
|
CNNGSCCdSCZqjqljZF
|
||||||
|
GvqpqrpqdqdsdGshSMhhRsSMhhlSlJ
|
||||||
|
DLCzzjzBwCbQWtQlRRFRRJFptfffgM
|
||||||
|
WzpLbLDbBcLPjWQWDBzzmnvNndHNqZqZNZNvcrNT
|
||||||
|
scHCGfWHsvWHVfGsggHfgvVcSLwLLPRwwDLPLllRPDzlPr
|
||||||
|
tbjqqNNTlPDTTSrD
|
||||||
|
QntmNbNnnddqJqqbFJHZWWHWJWvZHGVJsSsp
|
||||||
|
WZjpjwwGBGZQsqBLBHLHSRLP
|
||||||
|
mJhtdfVtDVJtvVLSmNRSccPPPlNHcH
|
||||||
|
JJLCFDhLCfVGGwbGGCwrGC
|
||||||
|
nBnsGSCrptmsLWGhWRvVRJVJ
|
||||||
|
rllMZZbcWWLJvhTl
|
||||||
|
MHwzczHwwHqZcdzMdbqSmwsssmtNCrBmtrnQNB
|
||||||
|
LzwrZNrNzBMrJBzJsfqqntMlVlSfhnhb
|
||||||
|
HTDPWDHPTgGHWTGcPFRgFpPPtfqmsfqlccmlSmnblbshqnmm
|
||||||
|
jWGgpRGPFRHjzdBBsrBJvj
|
||||||
|
hjNghjlwqjzGhwhGwLrMMrsMdsMfczPfsr
|
||||||
|
ZJQSFZFZpCTQSZHTTFbcWWPbWsWrdLVmrMWMfr
|
||||||
|
tttHSCpFQBQQpJZSJLgBNNDhqhBqvBvvRq
|
||||||
|
hLLJJJLcLPLfLwcJDchfhpSmqGbmdQGmGSdbqdbmqGGGdG
|
||||||
|
zgCCVVvVCNVssdbqmtMWvbnndD
|
||||||
|
rCCZZCVTjVZNzFZJBlflBLccDhBFFB
|
||||||
|
wwPPHfCMHQsrcwPbMPMcvQFJvqWgFTZgDFJltgZt
|
||||||
|
jRBVLhpNqpBmRhhRdNJZJgWTBBtgZWltZJJJ
|
||||||
|
mSjndhSzphjLRVqmhphNShrGMGrcbGbnGCHGwrwGfbbG
|
||||||
|
PVBRhBdlwRtRhRBwtBlVzDcGpVcZnggGzGMMsg
|
||||||
|
fFFWQqbFbLWCWvvFbTjjGnsZMfgsZcZzSZGMpSgD
|
||||||
|
QJTCCLFFLjFqFbHTbbltmhBNwwcNmthNhlHr
|
||||||
|
qwPJJsJdbPdwJddQCRCgCTMTRGGwMG
|
||||||
|
cLFcFBZNWWQLSQRfZjpljTGRCgGR
|
||||||
|
cFvrcNBFJDhzdQzv
|
||||||
|
zTsVTqDqQNtNwwMVmN
|
||||||
|
pHpSzPbRrvbRrGzGMwZwlBJmNtclwJpB
|
||||||
|
SjHRPfRbffPHqzCCCdTsTzqj
|
||||||
|
jnbMBnPjjjFtBtMjFPRtGfvvfzgWWHMfWHTlGgHH
|
||||||
|
dCpdqrVrmdpHfTJTCWGJgG
|
||||||
|
qVdrppqSTddqNwZcDPPPhZRBPBLBRLjF
|
||||||
|
VbHqLlGQlgjLjjQsNvCZTsNjMtCZvT
|
||||||
|
SJtttppwwpwBwdPvsvCvBZrvNrTrvM
|
||||||
|
JDnWJpDSSpmSwmpPzSwznhDlqGqqtqqHGHLlhblGbR
|
||||||
|
RqRJJVMPdRVVpqMdFwmvnSMwZcfCGfDSZc
|
||||||
|
CssQgjssvZvjffmS
|
||||||
|
zNlbbWTBLWCbCPPFPbVH
|
||||||
|
nvQsHSsGvNvnQghTRMrrjpjM
|
||||||
|
ttlLDlzPtGDcRRtpZTFjtgMj
|
||||||
|
PBLBwPPDzzLwblzffzLlVHHsCCHqsfvCCSsGSNWC
|
||||||
|
jHrTrThrtHgttThgHTtfgTgsmZZmBSZGSGsSGfZBZFFmQs
|
||||||
|
qCCPdbcCJddbRcsQSGhFzmZqZGmq
|
||||||
|
VVNNdVvclDcPbMWMwnnlwhphjp
|
||||||
|
ZdBgJqFWNNNqnZZNGsBCCCRvrCwCjCssCB
|
||||||
|
htDPMSPtMPzPTLMzMTMbRRbTbvwRCjfRfsbWWs
|
||||||
|
LhMmtMDWmHlpppplJZJgNd
|
||||||
|
mhtsjtbChcpLqmpmzL
|
||||||
|
DPlPprrfBrpGHHVGNVHRqcNvvLLqLcvJzzTvLc
|
||||||
|
VFfVPrrBQFPlDDwDwBpBtSgQjnghMhCdbSnnhtMM
|
||||||
|
DPDMpbsHPDPNtdtrgMtdnQ
|
||||||
|
WShWlSCJVlzccSBvBvhVZZWlgTNTrNrrQTjQjjjjgDSgSdNt
|
||||||
|
cvmCDvCJCcsRbmpFmqms
|
||||||
|
sSfFssmLnLwPtrrmttsFbDvWgCvddVgfgWdRDWlChD
|
||||||
|
nnGnHBzqHjqBJGChlRClhvghJWDd
|
||||||
|
jNzNcczMcGntPMwwSsSr
|
||||||
|
GGPCThCCvCTVWBCBGMVMsTgZJsrZtHNNtrsHJrgH
|
||||||
|
zjRwcwwfvSjmwznfzQSHDJtgrNrRNrLDsRrHtD
|
||||||
|
fjvzmcfSlSznwcnmnSQnhdlhWBpGpdBqhGhqhVPd
|
||||||
|
sHGGqpRqfNRVbDDtVwwzWf
|
||||||
|
CCLQZllTQLTcSShTQvjhQLnnWrDzVpwtDDwVDnczwMwM
|
||||||
|
vggZLZTldlhpCTlZlZCRRPNRmqdmGBHPFqsGqN
|
||||||
|
wwFDFLMDjjCNgNwNlwwgvR
|
||||||
|
frPbSJMSSPBqrfppSqrBZqMQhHlmNsRZmmslvghsmhsgggtZ
|
||||||
|
TPSPfBQrdJSfTTqSbbBfTfdcGWjFWWFDWnGMjLjGVFCj
|
||||||
|
LZRZbHtqnVztHTTTjMBQjQHH
|
||||||
|
rJcDGpwwgDwCCWFGSFMSffVWfF
|
||||||
|
cNNNgvhNglDnhdzsbLbmVs
|
||||||
|
RwmrGVPmNLzdmVpmrVtHDjjgDHHRqjFtngFt
|
||||||
|
CBlWhQWlTWshsblFGntjHtGbHG
|
||||||
|
WsTSGZSTQZZJpPNdzSrzwvpr
|
||||||
|
CVsggSgdwSwghVSTCgVZjJlRvlQNJHJGZVvjvj
|
||||||
|
qrrnzrrpDFMzbDbbzrMbBcNjRBHHQHGRRllHHPBNBljl
|
||||||
|
rnFppcpWcqnWMLDNsggSmWmsWfggdg
|
||||||
|
wjQzPjJcplwmDDBL
|
||||||
|
vghWhhnfWqzhftWtfnbFBmnGDnLGDbDmmC
|
||||||
|
zZNvZrNsWfgVftNZhQcSdPHPTcPHQQTTJV
|
||||||
|
WjvPVbWnbbFvjfLlcplQvLQvCwCl
|
||||||
|
sJhmrrTRTDDJHhhsmJhmrNDdQwLQQlHllHwwLpCLclBBlcPC
|
||||||
|
RJTRDdmPmmzNTDhnWtzMfMWtqjqqWM
|
||||||
|
vvpjqtllDMlHDtDBsPSSfBJFlSffNS
|
||||||
|
gwTmJrTcJWrNSmsNBBPfmf
|
||||||
|
VzzJzgTnddzWrwngnWqbHqbtLqjqvpvqhbMd
|
||||||
|
TlpzwGZGGFmZJdPpRtpHPrpcPs
|
||||||
|
CMJCMgQjMQvrfMHtMfHv
|
||||||
|
DjnNjCBqCCNnWWgDBQQDnCZwFJwmwwTznmFVwFmzTJJm
|
||||||
|
CcDPppDCFdDrFcFsMsdlLVjjLsMHvM
|
||||||
|
fqSmmtNGqLNffhHHbsMsbjbjNjbv
|
||||||
|
SthSGmLnmfwfWGWhSQGSQRnGpDpJPCDJrBPTcPrDwPzFcpFT
|
||||||
|
FdqjDtPWzqPdnPPtPFbssllqLJlqNppsJGppLp
|
||||||
|
TwfrcvwRgvfTBWRgBssJhspHfffJHlHNGh
|
||||||
|
MMZCQrrRBwQCCZMQwcTMwPztnFZSDWVWPttPSZzdzd
|
||||||
|
prHlrpJbdccllrrPbFdrgPzZfZhZVhRZVScNRNWtSZjWRW
|
||||||
|
LmwCCnvqwGCLMnsWtGRZWVfbfbftRW
|
||||||
|
bwnvBnLBvbsBvszHzpgBlPzHHlzg
|
||||||
|
grSJNTSgBHgpqhvCGbbZddGCGbbT
|
||||||
|
nDLMssQMRLwMtMWRWCZdQfqjfGvZQfCjCc
|
||||||
|
PqsDWPMLnwlRllJzghmgmSNhpgrl
|
||||||
|
TQGcWQBDnSzzsBSL
|
||||||
|
mJJlqJwVJdbSrhlrlhhsLL
|
||||||
|
JPtwMtdPbJbVqVNpPtmbpwZcQDFFcCccFjCQjpQWSWZg
|
||||||
|
JfbfpZJmzffmpZnZZwsrwDFvwHPP
|
||||||
|
RDdQtWTWQQSTGNRhsFsjnvjwrhPjtH
|
||||||
|
QccddTVQQldcGGRdGlgmVmBzfVpDmbgggmpL
|
||||||
|
HVnhVcHvpVFWDpmP
|
||||||
|
QswNZblTTwmqlntDPdqD
|
||||||
|
sGZzNwsGNThhMrhBBhzn
|
||||||
|
fQllBlVQncgwLlfWwWDvppZZggZqGpZgpGdvGG
|
||||||
|
shPTRsFbNFJmvqpGjrpvPDdr
|
||||||
|
RNFDtRRRssRTStRmTlnzwSVQlVVWfWzcQc
|
||||||
|
WmCpPCWTjQPCWWSjSTmrqRLGDRFGrTFDRFDLDD
|
||||||
|
gJnVcnVzdfnZgchvrslMDZGlRRDZLR
|
||||||
|
fdHhfncwfbfzJbnJzJfcczhhSmLCCNBjSpjmpjHjBQjpmpNW
|
||||||
|
BDvDPGRwRvCmLssGLmsL
|
||||||
|
frRjjlldrqtNspLWpqFcCmzm
|
||||||
|
ndSnVNtllldrdfSjfNvgVRHBwbbVMRbVPJgH
|
||||||
|
PpgjhpVLghPZhSgZVVzzcJWccPNCrcJzrFsJ
|
||||||
|
BdBNNMqMdfDnDNTFHHJCqHrJHzrFzF
|
||||||
|
wfMNtMndlBTlmTBndRpgghhjZRjvSZVjRw
|
||||||
|
ZQnQMWMcjHDHrWNF
|
||||||
|
TvtCvvBVgdRdmvBVNzDHlGFjFHjfRfDD
|
||||||
|
dvtCCbdJmhvhhhhbhVBPMwqZswnZqZjjMccsZJ
|
||||||
|
DDMzRBBSzRDTMQRZsbvssCbhZtCDtP
|
||||||
|
dLmwNplnmmwjGvPVCRtVVvVd
|
||||||
|
NNmjLmqWJjFRwFSrgcrSHBzcTz
|
||||||
|
TwTwTMBWcWBJJBtTWHddCmfgzlCzClsvmfsM
|
||||||
|
PPLDnNqPRLQNVnGNVsDQnNmzdhvdddlvdlqgqmdlrfvv
|
||||||
|
SQQsjPPLGLbDSnGLLNnWTFZJHbcpFctHZpwJWB
|
||||||
|
FzMltgtMzFpZtmzdjPpnvRTQTvRWTDfnnTlvwW
|
||||||
|
JcbVcBrqLCVJHJSNCcZVqVqqTRQRWWfNsTfTvDfsWvwTsnwv
|
||||||
|
rcZqVJVhmhgPmhmd
|
||||||
|
ttvSnlWvWWgcScMDsHHMPMjPmH
|
||||||
|
pzLGLfNRpJsvmmfvMDfs
|
||||||
|
GhpzRqqpZppNrhvFgwSlWnnBFn
|
||||||
|
sbQcDJQJJDbQhwchSctVnVnqTMvMWSqTMPSMlP
|
||||||
|
jtjCtNRLNCRgRnlTPPWg
|
||||||
|
pzpHdLtFNdJbDhJHsQhs
|
||||||
|
pSqnfqDnWPHNPCCHCp
|
||||||
|
GdJZQdgZbBvgQLcCZZCCZlPLRH
|
||||||
|
PzBgQggbvBthtMdMvbzvVfFfzTWqDmWDqzqWrfff
|
||||||
|
nnJdrfgfrdMCMdgrqMnWdgwNTTTzFhPSSHfSHhllzjzNFT
|
||||||
|
vBRvmvGZsLZZsHFNFFzTNPzb
|
||||||
|
LZVRmcDRvpQLmvvVGDGmpntJJwCWCnCPJwgJDrPDqM
|
||||||
|
QddMvdzlVfvdSQmGhmwLbGbmzbns
|
||||||
|
JtCCWqqZDsLpGhbGjD
|
||||||
|
FNrhqCTWMSRSrQQg
|
||||||
|
ZsBZJFsZSmmJsJSmrJrJrvsrdGdCQGQphMGwRMGQRGdbBChM
|
||||||
|
FlgfqNNNWnNnHfVnnHdbGwpwGWQhGdRMMdRM
|
||||||
|
LFnggHlDqDLvjDmZPcPmvP
|
||||||
|
CRHJWfvJvrQfrCsDlGGBszQBjjGB
|
||||||
|
LmPHVnMmpLlPssBPlDtd
|
||||||
|
MmMSZmVnncMFcmSVHvfSrffCwSvfbHWv
|
||||||
|
wsrJrpdJLsMCZDWL
|
||||||
|
BbLtGGbNmLQggqgQQtGgMmDCTnWZCZWZTmMmCZnT
|
||||||
|
qNBGNNgQcbbtGbbFBLVjfcfwHvrHHJHJcr
|
||||||
|
pCZCpdjBljhjBlpVccCpbDDwRWDsLhLbwDsDwsDw
|
||||||
|
HNgFSSNvSmdqwsFLFWLGttbw
|
||||||
|
gMMndNrzNHnzJZVlMCMCTcpc
|
||||||
|
CfsFNszCrrGzrsggsPfPVNVlqTdSjSqMTdSVTdLL
|
||||||
|
vRhcHllwJDmnJmDMMdhqSqpVMhdjdp
|
||||||
|
cvHRvwQBPZZlrQgz
|
||||||
|
TsFhCtQtQsBBLtBLPvgz
|
||||||
|
jjWZZjZSMNlNNjljNnlmjjfJLMBGGLvBdzPQpggJJLQzpg
|
||||||
|
wjbcmmlnQZmlrTsCFVwshwTr
|
||||||
|
nRGFnFjcdlwLSHSpNNnBfWHN
|
||||||
|
TgQvPbCMPRhbMPQvtQPvMCRBSHNQHBrQSNfWqpHHrWNWSf
|
||||||
|
PCgMbPvTZVDgtPRggtCCbgmmFJJLmcGFLjdmJFcDwJmm
|
||||||
|
dgWPssfdvQCLPLhL
|
||||||
|
pMtSMtpSmpMpFSMMFZjQCLbLQZZbVbVhNTLblZ
|
||||||
|
mpqcpzncfWwhzfRf
|
||||||
|
vntvVnRCsvpBpMjCpTpj
|
||||||
|
rQdZfhzczNzWcNLTpWgSvjjjpGpMSB
|
||||||
|
ZqNDQhfcNchLchQqcDqRHJtHVwnwbtvHsbVs
|
||||||
|
qtJGQgTrqtqQdQDgbGjPzZHWWzVjslPZlG
|
||||||
|
vBShwRRvvSRSvFvwLSvfcnfBWmHZHVWWHPzlNPWVWjZsWnWV
|
||||||
|
cLBFBFhCBLlwpFccFBFftqJDQdgdTDJJCbJgCCdg
|
||||||
|
wfmsPvPwNfvmfLNFvzzJbRMnllhlnLhRLC
|
||||||
|
gjtqDDTtjgpJcbnMTzCRnCCWhC
|
||||||
|
SDqtpGSStVtdqpgBVjBGZmFPJNJmffvfPsHZPZQd
|
||||||
|
HQMBBWrQQmPBvmBWnvrTnMSsbFfcfwgfCgscsmGgwgcJGg
|
||||||
|
NzzlJLthtlgswGFcwGst
|
||||||
|
JqNNRqpzhVRWTSQrrvSQ
|
||||||
|
mFpDZjvmtPPGvFjmmGTzTcFRbHczHTbzQgRS
|
||||||
|
fNdqhJsNrnnVNhwNVdrdsVczQCcwCMHSTCHgHCRzHgcM
|
||||||
|
JlgnNhsqVqNqNpPlvZvDDDGlZZ
|
6
src/input/day03_test1.txt
Normal file
6
src/input/day03_test1.txt
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
vJrwpWtwJgWrhcsFMMfFFhFp
|
||||||
|
jqHRNqRjqzjGDLGLrsFMfFZSrLrFZsSL
|
||||||
|
PmmdzqPrVvPwwTWBwg
|
||||||
|
wMqvLMZHhHMvwLHjbvcjnnSBnvTQFn
|
||||||
|
ttgJtRGJQctTZtZT
|
||||||
|
CrZsJsPPZsGzwwsLwLmpwMDw
|
@ -2,6 +2,7 @@ const std = @import("std");
|
|||||||
|
|
||||||
const day01 = @import("day01.zig");
|
const day01 = @import("day01.zig");
|
||||||
const day02 = @import("day02.zig");
|
const day02 = @import("day02.zig");
|
||||||
|
const day03 = @import("day03.zig");
|
||||||
const utils = @import("utils.zig");
|
const utils = @import("utils.zig");
|
||||||
|
|
||||||
fn solve_day(comptime day_num: u8, day: anytype, stdout: anytype, timer: *std.time.Timer) !void {
|
fn solve_day(comptime day_num: u8, day: anytype, stdout: anytype, timer: *std.time.Timer) !void {
|
||||||
@ -28,6 +29,7 @@ pub fn main() !void {
|
|||||||
|
|
||||||
try solve_day(1, day01, &stdout, &timer);
|
try solve_day(1, day01, &stdout, &timer);
|
||||||
try solve_day(2, day02, &stdout, &timer);
|
try solve_day(2, day02, &stdout, &timer);
|
||||||
|
try solve_day(3, day03, &stdout, &timer);
|
||||||
|
|
||||||
try bw.flush();
|
try bw.flush();
|
||||||
}
|
}
|
||||||
@ -37,5 +39,6 @@ test {
|
|||||||
|
|
||||||
_ = day01;
|
_ = day01;
|
||||||
_ = day02;
|
_ = day02;
|
||||||
|
_ = day03;
|
||||||
_ = utils;
|
_ = utils;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user