This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
int link[5009], size[5009]; | |
void init(int c) | |
{ | |
for(int i = 0; i < c; i++) link[i] = i, size[i] = 1; | |
} | |
int root(int x) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
#include <math.h> | |
#include <algorithm> | |
#include <map> | |
#include <iomanip> | |
using namespace std; | |
#define pdd pair <double, double> | |
struct edge{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string.h> | |
using namespace std; | |
int p[10009], w[10009]; | |
int main() | |
{ | |
int tc; | |
cin >> tc; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
using namespace std; | |
using ull = unsigned long long; | |
int main() | |
{ | |
int n; | |
cin >> n; | |
ull dp[n + 1][2]; // dp[i][0] i-th stripe ends with white | |
dp[1][0] = dp[1][1] = dp[2][0] = dp[2][1] = 1; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <map> | |
#include <unordered_map> | |
#include <utility> | |
#include <vector> | |
#include <limits.h> | |
#include <float.h> | |
#include <math.h> | |
using namespace std; | |
int r, c; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <string.h> | |
using namespace std; | |
int main() | |
{ | |
int size; | |
cin >> size; | |
int profit[size]; | |
for(int i = 0; i < size; i++) cin >> profit[i]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
int main() | |
{ | |
int n, t, tt; | |
cin >> n; | |
vector< int > friends[n + 1]; | |
for(int i = 1; i <= n; i++){ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <queue> | |
#include <vector> | |
#include <algorithm> | |
using namespace std; | |
long long const inf = 1e13; | |
vector< int > g[100009]; | |
vector< int > cost[100009]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <iostream> | |
#include <vector> | |
using namespace std; | |
const int inf = 1e8; | |
int main() | |
{ | |
int tcc; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//author: Abdul Matin | |
void init(int nodes) | |
{ | |
for(int i = 1; i <= nodes; i++) link[i] = i, size[i] = 1; | |
} | |
int root(int x) | |
{ | |
if(x != link[x]) return (link[x] = root(link[x])); |
OlderNewer