Skip to content

Commit ac60635

Browse files
committed
update
1 parent d19e086 commit ac60635

File tree

2 files changed

+116
-0
lines changed

2 files changed

+116
-0
lines changed

CP Templetes/Main.cpp

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
/*-----------------------------AIR-1-----------------------------------------*/
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
/*----------------------------------------------------------------------------*/
6+
typedef long long ll;
7+
typedef vector<int> vi;
8+
9+
/*----------------------------------------------------------------------------*/
10+
#define MOD 1e9 + 7
11+
#define pb push_back
12+
#define ppb pop_back
13+
#define f first
14+
#define s second
15+
#define nl "\n"
16+
#define pie 3.141592653589793238462
17+
#define set_bits(x) __builtin_popcountll(x)
18+
#define all(x) (x).begin(), (x).end()
19+
#define debug(x) cerr<<x<<" "
20+
#define loop(i,a,b) for(int i=(a);i<(b);i++)
21+
#define printvector(x) for(auto i:(x)) cout<<(i)<<" "
22+
23+
/*----------------------------------------------------------------------------*/
24+
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
25+
template<typename T> T binpow(T base,T power){ ll ans=1; while(power){if(power&1) ans=ans*base; base=base*base; power>>=1;}return ans;}
26+
27+
28+
/*----------------------------------------------------------------------------*/
29+
int main()
30+
{
31+
ios_base::sync_with_stdio(0);
32+
cin.tie(0);
33+
cout<<binpow(2,3)<<nl;
34+
35+
36+
37+
}
38+
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
/*-----------------------------AIR-1-----------------------------------------*/
2+
#include <bits/stdc++.h>
3+
using namespace std;
4+
5+
/*----------------------------------------------------------------------------*/
6+
typedef long long ll;
7+
typedef vector<int> vi;
8+
9+
/*----------------------------------------------------------------------------*/
10+
#define MOD 1e9 + 7
11+
#define pb push_back
12+
#define ppb pop_back
13+
#define f first
14+
#define s second
15+
#define nl "\n"
16+
#define pie 3.141592653589793238462
17+
#define set_bits(x) __builtin_popcountll(x)
18+
#define all(x) (x).begin(), (x).end()
19+
#define debug(x) cerr<<x<<" "
20+
#define loop(i,a,b) for(int i=(a);i<(b);i++)
21+
#define printvector(x) for(auto i:(x)) cout<<(i)<<" "
22+
23+
/*----------------------------------------------------------------------------*/
24+
template<typename T> T gcd(T a, T b) { return b ? gcd(b, a % b) : a; }
25+
template<typename T> T binpow(T base,T power){ ll ans=1; while(power){if(power&1) ans=ans*base; base=base*base; power>>=1;}return ans;}
26+
27+
28+
/*----------------------------------------------------------------------------*/
29+
class graph
30+
{
31+
public:
32+
unordered_map<int,vector<int>>adjlist;
33+
void addedge(int from,int to)
34+
{
35+
36+
adjlist[from].pb(to);
37+
}
38+
void printlist()
39+
{
40+
for(auto it:adjlist)
41+
{
42+
cout<<"from->"<<it.first<<" to-> ";
43+
for(auto nbr:it.second)
44+
{
45+
cout<<"("<<nbr<<")";
46+
}
47+
cout<<endl;
48+
}
49+
}
50+
};
51+
int main()
52+
{
53+
ios_base::sync_with_stdio(0);
54+
cin.tie(0);
55+
56+
graph g;
57+
int nodes;
58+
cin>>nodes;
59+
while(nodes--)
60+
{
61+
int from,to;
62+
cin>>from>>to;
63+
g.addedge(from,to);
64+
}
65+
g.printlist();
66+
67+
68+
}
69+
70+
71+
/*
72+
input:
73+
4
74+
0 1
75+
0 2
76+
1 3
77+
2 3
78+
*/

0 commit comments

Comments
 (0)