C++ (STL):
Request for member ‘push_back’ in ‘pos.std::vector<int>::operator[](((std::vector<int>::size_type)i))’, which is of non-class type ‘__gnu_cxx::__alloc_traits<std::allocator<int> >::value_type {aka int}’
pos[i].push_back(tmp);
vector<int> pos(MAX), vector<int> tmp;
I can't figure out why my code is getting wrong. So, Please tell, why is this error coming
Goal: I can't give the whole code as i faced the problem now only while coding a solution to a part of a code in a running contest. So, Please just tell me about this error. Then, my all other parts of code will work fine.
MY CODE:
/*
Name: SUSHANT OBEROI
College: MNNIT ALLAHABAD
Email: sushantoberoi3@gmail.com
Handle: soc3
*/
#include<bits/stdc++.h>
using namespace std;
#define sd(a) scanf("%d", &a)
#define slld(a) scanf("%lld", &a)
#define fl(i, a, b) for(int i=a; i<b; i++)
#define fle(i, a, b) for(int i=a; i<=b; i++)
#define ll long long
#define wl(q) while(q--)
#define MAX 300005
#define mp make_pair
#define fi first
#define se second
#define mod 1000000007
void print_output() {
vector<int> pos(MAX);
fl(i, 0, 100) {
pos[i].clear();
vector<int> tmp;
fl(j, 0, 100)
tmp.push_back(j);
pos[i].push_back(tmp);
}
}
int main() {
print_output();
return 0;
}
I think (according to me only, i don't what's the correct answer is?) that i am doing it correctly but compiler is wrong. (Sorry for saying this, but i think).