-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest.cpp
More file actions
135 lines (110 loc) · 2.75 KB
/
test.cpp
File metadata and controls
135 lines (110 loc) · 2.75 KB
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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
#include <bits/stdc++.h>
using namespace std;
#define sp ios_base::sync_with_stdio(false),cin.tie(NULL),cout.tie(NULL)
typedef long long ll;
#define pi pair<int,int>
#define FF first
#define SS second
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
template<class T> using oset=tree<T, null_type, less_equal<T>, rb_tree_tag, tree_order_statistics_node_update>;
template<class T, class U> using omap=tree<T, U, less<T>, rb_tree_tag, tree_order_statistics_node_update>;
void mod_pow(ll g, ll a, ll p){
cout<<"powers\n";
long long res = g;
int pow = 1;
cout<<pow<<" "<<g<<"\n";
while(pow <= a){
res = (res*res)%p;
pow = pow*2;
cout<<pow<<" "<<res<<"\n";
}
cout<<"g to the power a mod p\n";
res = 1;
while(a){
if(a&1){
res = (res*g)%p;
}
cout<<(a&1)<<" "<<res<<"\n";
g = (g*g)%p;
a>>=1;
}
}
int main() {
sp;
////////////////To Remove//////////////
freopen("input.txt", "r", stdin);
freopen("output.txt", "w", stdout);
///////////////////////////////////////
// oset<int> s;
// s.insert(1);
// s.insert(1);
// s.insert(2);
// s.insert(2);
// s.insert(2);
// s.insert(2);
// s.insert(2);
// s.insert(2);
// s.insert(2);
// s.insert(3);
// s.insert(3);
// s.erase(s.upper_bound(2));
// for(auto& x: s) cout<<x<<" ";
// cout<<"\n";
// omap<int, string> m;
// m[1] = "ayush";
// m[2] = "rma";
// for(auto& x: m) cout<<x.first<<" "<<x.second<<"\n";
// cout<<s.order_of_key(1);
// vector<int> a = {1,1,2,3,3,4,4,5,5,6,8,8};
// sort(a.rbegin(), a.rend());
// for(auto& x: a) cout<<x<<" ";
// cout<<"\n";
// auto x = equal_range(a.begin(), a.end(), 3, greater<int>());
// cout<<*lower_bound(a.begin(), a.end(), 7, greater<int>());
// int begin_index = x.first - a.begin();
// int end_index = x.second - a.begin();
// cout<<begin_index<<" "<<end_index;
//---------cryptography-----------
// long long g = 3;
// long long a = 115;
// long long p = 55;
// mod_pow(g, a, p);
// vector<ll> t = {3,5,15,25,54,110,225};
// ll b = 10;
// ll p = 439;
// vector<ll> s;
// for(auto& x: t){
// auto y = (x*b)%p;
// s.emplace_back(y);
// }
// for(auto& x: s) cout<<x<<" ";
/////////////////////////////////////
// vector<pi> a = {{0, 1},
// {2, 5},
// {6, 9},
// {10, 15}
// };
// set<pi> s(a.begin(), a.end());
// for(auto& x: s)cout<<x.FF<<" "<<x.SS<<"\n";
// auto x = *s.lower_bound({0, INT_MAX});
// cout<<x.FF<<" "<<x.SS<<"\n";
vector<vector<int>> g = {
{1, 2},
{2, 3, 4},
{1, 2, 3},
{0, 1},
{0, 1, 2, 3, 4, 5}
};
sort(g.begin(), g.end());
vector<int> haha = {1};
auto t = *lower_bound(g.begin(), g.end(), haha);
for(auto& x: t) cout<<x<<" ";
cout<<"\n";
for(auto& x: g){
for(auto& y: x) cout<<y<<" ";
cout<<"\n";
}
return 0;
}