Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <vector>
- #include <string>
- using namespace std;
- struct generale {
- int ID;
- int tempo;
- };
- struct speciale {
- int ID;
- int tempo;
- speciale* pun;
- /*
- speciale () {
- pun = NULL;
- }
- */
- };
- int main (){
- int K, N, C;
- cin >> K;
- cin >> N;
- cin >> C;
- vector<generale> myVector;
- vector<speciale*> myVector2;
- for (unsigned int i = 0; i < C; ++i) {
- speciale* testa = NULL;
- myVector2.push_back(testa);
- }
- for (unsigned int i = 0; i < N; ++i) {
- int id, t;
- cin >> id;
- cin >> t;
- generale g;
- g.ID = id;
- g.tempo = t;
- myVector.push_back(g);
- char val;
- char str = ';';
- for (cin >> val; val != str; cin >> val) {
- int indice = val - '0';
- speciale* s;
- s -> ID = id;
- s -> tempo = t;
- s -> pun = myVector2[indice];
- myVector2[indice] = s;
- }
- }
- for (unsigned int i = 0; i < myVector.size(); ++i)
- cout << myVector[i].ID << " " << myVector[i].tempo << endl;
- for (unsigned int i = 0; i < C; ++i){
- speciale* p = myVector2[i];
- while(p != NULL){
- cout << p -> ID << " " << p -> tempo << endl;
- p = p -> pun;
- }
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement