Skip to content

Instantly share code, notes, and snippets.

@hjroh0315
Created January 2, 2022 07:16
Show Gist options
  • Save hjroh0315/216eaa4fa5aea0402ad3fd0c978e9e16 to your computer and use it in GitHub Desktop.
Save hjroh0315/216eaa4fa5aea0402ad3fd0c978e9e16 to your computer and use it in GitHub Desktop.
하이퍼문제 이걸로 풀어보실 분 구합니다
#include <iostream>
#include <vector>
#include <deque>
#include <initializer_list>
using namespace std;
template<int>
struct multivector;
template<>
struct multivector<1>
{
vector<int> vec;
multivector<1>(deque<int> np): vec(np[0]){}
int& operator[](int n)
{
return vec[n];
}
};
template<int d>
struct multivector
{
vector<multivector<d-1>> vec;
multivector<d>(deque<int> np)
{
int k = np[0];
np.pop_front();
vec=vector<multivector<d-1>>(k,np);
}
multivector<d>(initializer_list<int> il)
{
deque<int>np = il;
int k = np[0];
np.pop_front();
vec=vector<multivector<d-1>>(k,np);
}
void add_row(int n)
{
while(n--)vec.push_back(multivector<d-1>());
}
multivector<d-1>& operator[](int n)
{
return vec[n];
}
};
int main()
{
multivector<11> mvec({1,1,1,1,1,1,1,1,1,1,1});
mvec[0][0][0][0][0][0][0][0][0][0][0]=1;
cout << mvec[0][0][0][0][0][0][0][0][0][0][0] << endl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment