Rezultati

Up. imeNalogaJezikRezultatČas oddaje
attempterji-2019 Malica C++ 100/100OK 09. maj '19 @ 16:44

Test Točke Porabljen spomin Porabljen čas Status
#1 [več] 16/16 3,039 MiB 0,000 s OK
#2 [več] 16/16 3,199 MiB 0,057 s OK
#3 [več] 17/17 3,191 MiB 0,016 s OK
#4 [več] 17/17 3,047 MiB 0,016 s OK
#5 [več] 17/17 3,203 MiB 0,004 s OK
#6 [več] 17/17 3,199 MiB 0,069 s OK

Ocenjevani program (malica.cpp):
#include <iostream>
#include <vector>
#include <cstring>
#include <string>
#include <sstream>
#include <algorithm>
#include <map>
#include <fstream>
#include <utility>

using namespace std;

struct Sendvic {
	int sirov, vegan, ost;
};

int main() {
	int n, q;
	cin >> n >> q;
	vector<Sendvic> sendvici(q);
	for (int i = 0; i < q; ++i) {
		sendvici[i].sirov = 0;
		sendvici[i].vegan = 0;
		sendvici[i].ost = 0;
	}

	int x, current;
	string line, sendv;
	cin.ignore();
	
	for (int i = 0; i < n; ++i) {
		getline(cin, line);
		stringstream s;
		s << line;
		s >> x >> current;
		for (int j = 0; j < x; ++j) {
			getline(cin, line);
			stringstream q(line);
			q >> sendv;
			if (sendv == "sirov") {
				sendvici[current - 1].sirov++;
			}
			else if (sendv == "veganski") {
				sendvici[current - 1].vegan++;
			}
			else {
				sendvici[current - 1].ost++;
			}
			
		}
	}
	for (int i = 0; i < q; ++i) {
		cout << sendvici[i].sirov << " " << sendvici[i].vegan << " " << sendvici[i].ost << "\n";
	}


	return 0;
}