Skip to content

Instantly share code, notes, and snippets.

View osjayaprakash's full-sized avatar
💭
I may be slow to respond.

Jayaprakash Sundararaj osjayaprakash

💭
I may be slow to respond.
View GitHub Profile
@osjayaprakash
osjayaprakash / SPOJ-ARRAYSUB.cpp
Created December 22, 2012 18:45
SPOJ, Segment Tree
#include <iostream>
#include <cstring>
using namespace std;
int val[2000010];
int mx[2000010];
int K,N;
void setmax(int &a, int b) {if(a<b) a=b;}
int build(int Node, int start, int end)
@osjayaprakash
osjayaprakash / SPOJ-AMZWORLD.cpp
Created December 22, 2012 18:48
SPOJ, Simple
#include <stdio.h>
int a[3]={1,1,1};
int p[3]={1,1,1};
int main()
{
int n;
scanf("%d", &n);
while(--n)
#include <iostream>
#include <cstring>
using namespace std;
typedef unsigned ull;
void setmax( int &a, int b) { if(a<b) a=b; }
ull res;
#define MAX 50005
int rem; //0..999
int YEARS; //40
@osjayaprakash
osjayaprakash / SPOJ-HISTOGRA.cpp
Created December 22, 2012 18:51
SPOJ, Simple
#include <iostream>
using namespace std;
void max( long long int &a, long long int b) { if(a<b) a=b; }
long long int res;
#define MAX 100005
long long int V[MAX]; int N;
int l1[MAX];
int l2[MAX];
int fn(int *l)
@osjayaprakash
osjayaprakash / SPOJ-ARBITRAG.cpp
Created December 23, 2012 09:37
SPOJ, ARBITRAG, ARBITRAGE, FLOYD WARSHALL
#include <iostream>
#include <queue>
#include <vector>
#include <map>
using namespace std;
int N,M;
map<string, int> nodes;
double v[300][300];
int main ()
@osjayaprakash
osjayaprakash / SPOJ-ELEVTRBL.cpp
Created December 23, 2012 10:19
SPOJ, ELEVTRBL, DFS, A*, DIJISTRA
#include <iostream>
#include <queue>
#include <cstring>
#include <vector>
#include <map>
using namespace std;
int f,s,g,u,d;
unsigned mini[1000005];
/*
SPOJ Problem Set (classical)
1436. Is it a tree
Problem code: PT07Y
*/
#include <cstdio>
#include <cmath>
#include <vector>
#include <map>
#include <cstdio>
#include <iostream>
#include <vector>
#define N 101
using namespace std;
int max(int a,int b){
if(a>b)
return a;
else
#include <cstdio>
#include <iostream>
#include <vector>
#define N 101
using namespace std;
int min(int a,int b){
if(a<b)
return a;
else
return b;
#include <iostream>
#include <vector>
#include <queue>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
const int mod = 1000000007;
int main()
{