Posts

Showing posts with the label POJ

POJ Catch That Cow

----------------------- Solution: Version 1 ------------------------------------ // Accepted #include<iostream> #include<vector> #include<cstdio> #include<cmath> #include<queue> #include<map> using namespace std; #define sf scanf #define pf printf #define fast ios_base::sync_with_stdio(false) typedef long long LL; typedef map<LL, LL>mpll; const int high = 1e5+3; const int limit=1e5; const int inf = (1<<31)-1; LL visited[high], level[high]; //mpll visited, level; void CLR() {     for(int i=0; i<high; i++)     {         visited[i]=0;         level[i]=0;     } } void BFS(int x, int K) {     queue<LL>Q;     LL v;     visited[x]=1;     level[x] = 0;     Q.push(x);     while(!Q.empty())     {     ...

POJ 2643 Election

Problem Link: POJ Election /**   *  @Author: Pranta Sarker   *   **/ /**   *  @Author: Pranta Sarker   *   **/ #include<iostream> #include<cstring> #include<map> #include<string> #include<vector> using namespace std; #define fast ios_base::sync_with_stdio(0) #define bfast cin.tie(0) #define outs(x) cout << x << " " #define outn(x) cout << x << "\n" #define sf scanf #define pf printf #define pfn(x , k) printf(k , x) #define nl puts("") #define psb push_back #define mset(c,v) memset(c , v , sizeof c) #define loop0(n) for(int i=0; i<n; i++) #define loop1(n) for(int i=1; i<=n; i++) #define mpair(x , y) make_pair(x , y) #define all(x) x.begin(), x.end() #define pi acos(-1.0) #define psb push_back #define clr clear() typedef unsigned long long ull; typedef long long LL; typedef vector<int>vii; typedef vector<LL>vll; typedef vector<string>vs; typedef map<int, int...