# | Time | Username | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1173770 | manuelalejandro | Bitaro the Brave (JOI19_ho_t1) | C++20 | 0 ms | 0 KiB |
{
"Basic": {
"prefix": "create_basic",
"body": [
"#include <bits/extc++.h>",
"",
"#define int long long ",
"#define pb push_back",
"#define all(x) (x).begin(),(x).end()",
"#define rall(x) (x).rbegin(),(x).rend()",
"#define tam(x) (int)(x).size()",
"#define endl '\\n'",
"#define sd second",
"#define fs first",
"#define maxs(x,y) (x = max(x,y))",
"#define mins(x,y) (x = min(x,y))",
"#define optmizar_io ios_base::sync_with_stdio(0); cin.tie(0);",
"#define Setpre(n) cout << fixed <<setprecision(n)",
"#define dbg(x) for(auto y: x) cout << y <<' '; cout << endl;",
"#define dbg1(x) for(auto y: x) cout << y.first <<' '<< y.second << endl;",
"#define dbg2(v) for(auto x: v) cout << x.a<< ' '<< x.b <<' '<< x.c << endl;",
"",
"const int MAX = 501;",
"const int INF = 1e9;",
"const int Mod = 1e9+7;",
"const int zero = 0;",
"const double eps = 1e-6;",
"const double PI=acos(-1.0);",
"const int mox[8] ={-1,1,0,0,-1,-1,1,1};",
"const int moy[8] ={0,0,-1,1,-1,1,-1,1};",
"",
"using namespace std;",
"using namespace __gnu_pbds;",
"",
"typedef vector<int> vi;",
"typedef vector<vi> vvi;",
"typedef pair<int,int> pi;",
"typedef vector<bool> vbol;",
"typedef array<int, 3> arr;",
"",
"template <typename T>",
"using ordered_set = tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;",
"",
"",
"void cases(string s){",
"#ifndef ONLINE_JUDGE",
" if(tam(s) == 0) s = \"1\"; ",
" string a = s + \".in\";",
" string b = s + \".out\";",
" freopen(a.c_str(), \"r\", stdin);",
" freopen(b.c_str(), \"w\", stdout);",
"#endif",
"}",
"",
"",
"void _1()",
"{",
" ",
"}",
"",
"",
" ",
"",
"int32_t main() {",
" optmizar_io ",
" // cases(\"\");",
"",
" //start: ",
" //end: ",
" //tags: ",
" //difficulty:",
" //comment: ",
" ",
" int T = 1; //cin >> T;",
" while(T--)",
" _1();",
"",
"",
" return 0;",
"}",
"",
"",
""
]
},
"create_compresion": {
"prefix": "create_compresion",
"body": [
"vi d = v;",
" sort(all(d));",
" d.resize(unique(all(d)) - d.begin());",
"",
" for(int i = 1; i <= n; i++)",
" v[i] = lower_bound(all(d), v[i]) - d.begin();",
"",
"// d[v[i]] = original value",
""
]
},
"create_basic_estruct_mo": {
"prefix": "create_basic_estruct_mo",
"body": [
"const int BLOCK_SIZE = 800;",
"",
"struct Query",
"{",
" int l, r, id;",
"",
" bool operator<(const Query& other) const {",
" int a = l / BLOCK_SIZE;",
" int b = other.l / BLOCK_SIZE;",
" if(a != b) return a < b;",
" else return (a & 1) ? r > other.r : r < other.r;",
" }",
"};",
"",
"void Add()",
"{",
"",
"}",
"",
"void Del()",
"{",
"",
"}",
"",
"",
" while(qq.l < l)",
" --l;",
"",
" while(qq.l > l)",
" l++;",
"",
" while(qq.r < r)",
" r--;",
"",
" while(qq.r > r)",
" ++r;"
]
},
"create_FenwickTree2D": {
"prefix": "create_FenwickTree2D",
"body": [
"struct FenwickTree2D",
"{",
" vvi tree;",
" int n, m;",
"",
" FenwickTree2D(int n, int m) : n(n), m(m), tree(n + 1, vi(m + 1)) {}",
"",
" int LSB(int x)",
" {",
" return (x & -x);",
" }",
"",
" int query(int i, int j)",
" {",
" int sum = 0;",
" for(; i > 0; i -= LSB(i))",
" for(int jj = j; jj > 0; jj -= LSB(jj))",
" sum += tree[i][jj];",
"",
" return sum;",
" }",
"",
" void update(int i, int j, int delta)",
" {",
" for(; i <= n; i += LSB(i))",
" for(int jj = j; jj <= m; jj += LSB(jj))",
" tree[i][jj] += delta;",
" } ",
" ",
" int query(int x1, int y1, int x2, int y2)",
" {",
" return query(x2, y2) - query(x1 - 1, y2) - query(x2, y1 - 1) + query(x1 - 1, y1 - 1);",
" }",
"",
"};",
""
]
}
}