Rezultati

Up. imeNalogaJezikRezultatČas oddaje
DROPTABLE-2017 Pasavci C++ 0/100Napaka med izvajanjem / ob izhodu (RTE) 11. maj '17 @ 17:07

Test Točke Porabljen spomin Porabljen čas Status
#1 5/5 3,539 MiB 0,004 s OK
#2 5/5 4,070 MiB 0,004 s OK
#3 5/5 11,348 MiB 0,027 s OK
#4 5/5 42,160 MiB 0,103 s OK
#5 5/5 60,371 MiB 0,137 s OK
#6 0/5 128,336 MiB 0,298 s Prekoračen spomin
#7 5/5 111,828 MiB 0,260 s OK
#8 0/5 128,195 MiB 0,291 s Prekoračen spomin
#9 0/6 128,270 MiB 0,306 s Prekoračen spomin
#10 0/6 135,840 MiB 0,222 s Prekoračen spomin
#11 6/6 3,125 MiB 0,004 s OK
#12 6/6 3,215 MiB 0,004 s OK
#13 6/6 3,125 MiB 0,004 s OK
#14 6/6 3,125 MiB 0,004 s OK
#15 6/6 6,668 MiB 0,046 s OK
#16 6/6 3,117 MiB 0,004 s OK
#17 6/6 3,211 MiB 0,004 s OK
#18 6/6 5,188 MiB 0,010 s OK

Ocenjevani program (pasavci.cpp):
#include <iostream>
#include <string>
#include <vector>

using namespace std;

int main() {
	string p, s1, s2;
	getline(cin, p);
	getline(cin, s1);
	getline(cin, s2);

	int m;
	cin >> m;

	vector<int> a, b;
	vector<string> s;
	s.push_back(s1);
	s.push_back(s2);

	for (int i = 0; i < m; i++) {
		int x, y;
		cin >> x >> y;
		a.push_back(x);
		b.push_back(y);

		string g = s[a[i] - 1] + s[b[i] - 1];

		s.push_back(g);
	}

	int count = 0;
	size_t nPos = s[s.size() - 1].find(p, 0);
	while (nPos != string::npos) {
		count++;
		nPos = s[s.size() - 1].find(p, nPos + 1);
	}

	cout << count;

	return 0;
}