|
|
@ -127,7 +127,7 @@ struct factorNumber{ |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
struct Monkey{ |
|
|
|
struct Monkey{ |
|
|
|
std::vector<factorNumber> items; |
|
|
|
std::vector<long long> items; |
|
|
|
char operation; |
|
|
|
char operation; |
|
|
|
int operation_amt; |
|
|
|
int operation_amt; |
|
|
|
int divisible; |
|
|
|
int divisible; |
|
|
@ -141,18 +141,18 @@ int main() |
|
|
|
std::vector<Monkey> monkeys; |
|
|
|
std::vector<Monkey> monkeys; |
|
|
|
std::ifstream file("input"); |
|
|
|
std::ifstream file("input"); |
|
|
|
|
|
|
|
|
|
|
|
/*monkeys.push_back({{89,95,92,64,87,68},'*',11,2,7,4});
|
|
|
|
monkeys.push_back({{89,95,92,64,87,68},'*',11,2,7,4}); |
|
|
|
monkeys.push_back({{87,67},'+',1,13,3,6}); |
|
|
|
monkeys.push_back({{87,67},'+',1,13,3,6}); |
|
|
|
monkeys.push_back({{95, 79, 92, 82, 60},'+',6,3,1,6}); |
|
|
|
monkeys.push_back({{95, 79, 92, 82, 60},'+',6,3,1,6}); |
|
|
|
monkeys.push_back({{67, 97, 56},'*',-1,17,7,0}); |
|
|
|
monkeys.push_back({{67, 97, 56},'*',-1,17,7,0}); |
|
|
|
monkeys.push_back({{80, 68, 87, 94, 61, 59, 50, 68},'*',7,19,5,2}); |
|
|
|
monkeys.push_back({{80, 68, 87, 94, 61, 59, 50, 68},'*',7,19,5,2}); |
|
|
|
monkeys.push_back({{73, 51, 76, 59},'+',8,7,2,1}); |
|
|
|
monkeys.push_back({{73, 51, 76, 59},'+',8,7,2,1}); |
|
|
|
monkeys.push_back({{92},'+',5,11,3,0}); |
|
|
|
monkeys.push_back({{92},'+',5,11,3,0}); |
|
|
|
monkeys.push_back({{99, 76, 78, 76, 79, 90, 89},'+',7,5,4,5});*/ |
|
|
|
monkeys.push_back({{99, 76, 78, 76, 79, 90, 89},'+',7,5,4,5}); |
|
|
|
monkeys.push_back({{79,98},'*',19,23,2,3}); |
|
|
|
/*monkeys.push_back({{79,98},'*',19,23,2,3});
|
|
|
|
monkeys.push_back({{54, 65, 75, 74},'+',6,19,2,0}); |
|
|
|
monkeys.push_back({{54, 65, 75, 74},'+',6,19,2,0}); |
|
|
|
monkeys.push_back({{79, 60, 97},'*',-1,13,1,3}); |
|
|
|
monkeys.push_back({{79, 60, 97},'*',-1,13,1,3}); |
|
|
|
monkeys.push_back({{74},'+',3,17,0,1}); |
|
|
|
monkeys.push_back({{74},'+',3,17,0,1});*/ |
|
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
factorNumber test(17); |
|
|
|
factorNumber test(17); |
|
|
@ -173,7 +173,7 @@ int main() |
|
|
|
Monkey&m=monkeys[i]; |
|
|
|
Monkey&m=monkeys[i]; |
|
|
|
m.inspAmt+=m.items.size(); |
|
|
|
m.inspAmt+=m.items.size(); |
|
|
|
for (int j=0;j<m.items.size();j++){ |
|
|
|
for (int j=0;j<m.items.size();j++){ |
|
|
|
factorNumber worryLevel=m.items[j]; |
|
|
|
long long worryLevel=m.items[j]; |
|
|
|
//std::cout<<worryLevel<<std::endl;
|
|
|
|
//std::cout<<worryLevel<<std::endl;
|
|
|
|
if (m.operation=='+'){ |
|
|
|
if (m.operation=='+'){ |
|
|
|
if (m.operation_amt!=-1){ |
|
|
|
if (m.operation_amt!=-1){ |
|
|
@ -184,8 +184,11 @@ int main() |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
if (m.operation_amt!=-1){ |
|
|
|
if (m.operation_amt!=-1){ |
|
|
|
worryLevel*=m.operation_amt; |
|
|
|
worryLevel*=m.operation_amt; |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
worryLevel*=worryLevel; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
worryLevel%=9699690; |
|
|
|
if (worryLevel%m.divisible==0){ |
|
|
|
if (worryLevel%m.divisible==0){ |
|
|
|
Monkey&newMonkey=monkeys[m.trueThrow]; |
|
|
|
Monkey&newMonkey=monkeys[m.trueThrow]; |
|
|
|
newMonkey.items.push_back(worryLevel); |
|
|
|
newMonkey.items.push_back(worryLevel); |
|
|
|