vector of vector again stl
#include<bits/stdc++.h>
using namespace std;
#define shailesh ios::sync_with_stdio(false); cin.tie(0); cout.tie(0);
#define ll long long int
#define vi vector<int>
#define pii pair<int, int>
#define vii vector<pii>
#define rep(i, a, b) for(int i=a; i<b; i++)
#define ff first
#define ss second
void printVec(vector<int> &v){
cout<<"size : "<<v.size()<<" "<<endl;
for (int i = 0; i < v.size(); i++)
{
cout<<v[i]<<" ";
}
cout<<endl;
}
int main(){
shailesh
vector<vector<int>> v;
int N;
cin>>N;
for (int i = 0; i < N; i++)
{
int n;
cin>>n;
vector<int> temp;
for (int j = 0; j < n; j++)
{
int x;
cin>>x;
temp.push_back(x);
}
v.push_back(temp);
}
v[0].push_back(10);
v.push_back(vector<int> ());
for (int i = 0; i < v.size(); i++)
{
printVec(v[i]);
}
cout<<v[0][1];
return 0;
}
// input /output
3
3
1 2 3
3
3 4 5
2
1 2
size : 4
1 2 3 10
size : 3
3 4 5
size : 2
1 2
size : 0
2
Comments
Post a Comment