Stop writing articles that don't rank.

Stop writing articles that don't rank. Midgen AI's Article Generator crafts well-researched, SEO-optimized content that engages readers and pleases search engines.

🔗 https://midgen.ai/

#SEOContent #ArticleWriting #ContentMarketing #midgen #midgenai #midgenhq #RankHigher

Comments

Anonymous said…
#include
using namespace std;

int main() {
ios::sync_with_stdio(false);
cin.tie(nullptr);

int t;
cin >> t;
while (t--) {
int n, m;
cin >> n >> m;

set st; // store chemicals
for (int i = 0; i < n; i++) {
long long x;
cin >> x;
st.insert(x);
}

vector> rules(m);
for (int i = 0; i < m; i++) {
cin >> rules[i][0] >> rules[i][1] >> rules[i][2];
}

bool changed = true;

// repeat until no new chemical is added
while (changed) {
changed = false;

for (auto &r : rules) {
long long x = r[0], y = r[1], z = r[2];

if (st.count(x) && st.count(y) && !st.count(z)) {
st.insert(z);
changed = true; // new chemical added
}
}
}

cout << st.size() << "\n";
}

return 0;
}

Popular posts from this blog

12 Best Websites to Practice Coding for Beginners

Using Generic in TypeScript about types in the Code

Usage of Common “Header files” in C programming