-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathvector of vector.cpp
48 lines (41 loc) · 1.07 KB
/
vector of vector.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/******************************************************************************
Online C++ Compiler.
Code, Compile, Run and Debug C++ program online.
Write your code in this editor and press "Run" button to compile and execute it.
*******************************************************************************/
#include<bits/stdc++.h>
#include <iostream>
#include<algorithm>
#include<vector>
using namespace std;
int main()
{
int n;
cin>>n;
vector<vector<int>> V;
for(int i=0;i<n;i++)
{
int m;
cin>>m;
vector<int> temp;
for(int j=0;j<m;j++)
{
int x;
cin>>x;
temp.push_back(x);
}
V.push_back(temp);
}
V.push_back(vector<int> ());//add extra vector of size 0 , just for example
cout<<"output"<<endl;
for(int i=0;i<V.size();i++)
{
cout<<"size : "<<V[i].size()<<endl;
for(int j=0;j<V[i].size();j++)
{
cout<<V[i][j]<<" ";
}
cout<<endl;
}
return 0;
}