Advertisement
Guest User

Untitled

a guest
Jun 26th, 2018
134
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.36 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3.  
  4. set <string> S;
  5.  
  6. int main() {
  7.     ifstream in ("input.txt");
  8.     ofstream out ("output.txt");
  9.    
  10.     int N;
  11.     in >> N;
  12.     int sol = 0;
  13.     for (int i=0; i<N; i++) {
  14.         string a, b, c;
  15.         string op1, op2;
  16.         in >> a >> op1 >> b >> op2 >> c;
  17.        
  18.         S.insert (a);
  19.         if (S.count(b)==0 && S.count(c)==0) sol++;
  20.     }
  21.     out << sol;
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement