In this particular case the set - previously mentioned in the tutorial section - denotes how many qudruples there are such that . The global answer is .
C++
#include <iostream>#include <vector>using namespace std;void precompute(vector<int> &mobius, vector<int> &comb) {mobius[1] = -1;for (int i = 1; i < (int)mobius.size(); i++) {if (mobius[i]) {mobius[i] = -mobius[i];
Join the USACO Forum!
Stuck on a problem, or don't understand a module? Join the USACO Forum and get help from other competitive programmers!