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
// Ivan Carvalho | |
// Paralelogramo - Seletiva IOI - OBI 2007 | |
// O(n^2 * log(n)) | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef pair<int,int> ii; | |
map<ii, map<double,int> > tab; | |
map<ii,int > special; | |
map<ii,int> freq; | |
int X[1001],Y[1001]; |
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
// Ivan Carvalho | |
// Tatu - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
#define MP make_pair | |
#define MAXN 261 | |
#define INF 1010 | |
using namespace std; | |
typedef pair<int,int> ii; | |
typedef pair<ii,ii> i4; | |
int matriz[MAXN][MAXN],acumulada[MAXN][MAXN],linear[MAXN]; |
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
// Ivan Carvalho | |
// Cantores - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
#define MAXN 100010 | |
#define MP make_pair | |
#define F first | |
#define S second | |
using namespace std; | |
typedef pair<char,char> cc; | |
typedef pair<cc,cc> c4; |
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
// Ivan Carvalho | |
// Passeio - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
#define MP make_pair | |
using namespace std; | |
typedef long long ll; | |
typedef pair<ll,ll> ii; | |
typedef struct node* pnode; | |
typedef vector<ll>::iterator ite; | |
const ll MAXN = 1e5 + 10; |
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
// Ivan Carvalho | |
// Frequência - Fase 2 Programação Nível 2 - OBI 2014 | |
// O(r*n*log(n)) | |
#include <bits/stdc++.h> | |
#define MP make_pair | |
using namespace std; | |
typedef pair<int,int> ii; | |
typedef struct node* pnode; | |
const int MAXN = 1e5 + 10; | |
const int MAXR = 51; |
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
// Ivan Carvalho | |
// Ciclovias - Fase 2 Programação Nível 2 - OBI 2016 | |
// O(m*log(n)) | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef struct node* pnode; | |
const int MAXN = 1e5 + 10; | |
struct node{ | |
int val; | |
pnode l,r; |
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
// Ivan Carvalho | |
// Intervalo - Seletiva IOI - OBI 2014 | |
// Alternative solution : O(n*lg(n)) | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef struct node* pnode; | |
typedef long long ll; | |
struct node{ | |
pnode l,r; | |
ll puro,total; |
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
// Ivan Carvalho | |
// Cachecol da Vovó Vitória - Fase 2 Programação Nível 2 - OBI 2013 | |
// O(log(n)) | |
#include <bits/stdc++.h> | |
#define REP(A,B) for(long long A=0;A<B;A++) | |
using namespace std; | |
typedef long long ll; | |
const ll MOD = 1e9 + 7; | |
const ll MAXK = 2; | |
typedef struct matrix{ |
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
// Ivan Carvalho | |
// Catálogo de Músicas - Fase 1 Programação Nível 2 - OBI 2013 | |
// O(n*log(n)) | |
#include <bits/stdc++.h> | |
using namespace std; | |
const int MAXN = 3*1e5 + 10; | |
int ponteiro,N,n,tam[MAXN],filhos[MAXN],nivel[MAXN],total,resp; | |
set<int> grafo[MAXN]; | |
map<string,int> conversao; | |
void dfs1(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
// Ivan Carvalho | |
// Simulador - Fase 2 Programação Nível 2 - OBI 2009 | |
// O(M^2) | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
struct range{ | |
ll ini,fim; | |
ll A,B; | |
range(ll _A,ll _B,ll add = 0){ |
OlderNewer