Cod sursa(job #2634596)

Utilizator betybety bety bety Data 11 iulie 2020 16:28:31
Problema Dtcsu Scor 0
Compilator cpp-64 Status done
Runda Arhiva de probleme Marime 0.92 kb
#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
class InParser {
private:
	FILE *fin;
	char *buff;
	int sp;
	char read_ch() {
		++sp;
		if (sp == 4096) {
			sp = 0;
			fread(buff, 1, 4096, fin);
		}
		return buff[sp];
	}
public:
	InParser(const char* nume) {
		fin = fopen(nume, "r");
		buff = new char[4096]();
		sp = 4095;
	}
	InParser& operator >> (ll &n) {
		char c;
		n = 0;
		while (!isdigit(c = read_ch()) && c != '-');
		ll sgn = 1;
		if (c == '-') {
			n = 0;
			sgn = -1;
		} else {
			n = c - '0';
		}
		while (isdigit(c = read_ch())) {
			n = 10 * n + c - '0';
		}
		n *= sgn;
		return *this;
	}
};
InParser in("dtcsu.in");
ofstream out("dtcsu.out");
set<ll> s;
int main()
{
    ll n=276997,tst,x,ans=0;
    for(ll i=1;i<=n;++i)
      in>>x,s.insert(x);
    in>>tst;
    while(tst--) in>>x,ans+=(s.find(x)!=s.end());
    out<<ans<<'\n';
    return 0;
}