-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemplate.cpp
90 lines (71 loc) · 1.83 KB
/
template.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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
// This is just a template solution used as initial script
#include <bits/stdc++.h>
#include <stdlib.h> /* abs */
#include <iostream>
#include <vector>
#include <numeric>
#include <unordered_map>
#include <map>
using namespace std;
using ll = long long;
using ull = unsigned long long;
using vi = vector<int>;
using pi = pair<int,int>;
#define INF std::numeric_limits<int>::max()
#define LLINF std::numeric_limits<long long>::max()
#define F(i, n) for (ll i = 0; i < n; ++i)
#define FF(i, start, n) for (ll i = start; i < n; ++i)
#define VPRINT(name, v) \
cout << name << " : "; \
for (auto& e : v) { \
cout << e << " "; \
} \
cout << std::endl;
#define VVPRINT(name, v) \
cout << name << " : " << endl; \
for (auto& e : v) { \
for (auto& k : e) { \
cout << k << " "; \
} \
cout << endl; \
} \
cout << std::endl;
template <typename T, typename A>
int arg_max(std::vector<T, A> const& vec) {
return static_cast<int>(std::distance(vec.begin(), max_element(vec.begin(), vec.end())));
}
template <typename T, typename A>
int arg_min(std::vector<T, A> const& vec) {
return static_cast<int>(std::distance(vec.begin(), min_element(vec.begin(), vec.end())));
}
vector<int> binary2(ll x)
{
vector<int> res;
while (x > 0)
{
res.push_back(x % 2);
x >>= 1;
}
return res;
}
void primeFactors(vector<int>& v, int n)
{
while (n % 2 == 0) {v.push_back(2);n = n/2;}
for (int i = 3; i <= sqrt(n); i = i + 2) {while (n % i == 0){ v.push_back(i); n = n/i;}}
if (n > 2) v.push_back(n);
}
// vector<pair<int, int>> v;
// sort(v.begin(), v.end(), [](auto const& a, auto const& b) {
// return a.second > b.second;
// });
int main()
{
std::ios::sync_with_stdio(false);
std::cin.tie(nullptr);
ll tt;
cin >> tt;
F(tti, tt)
{
}
return 0;
}