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 | |
// Falta uma - Fase 2 Programação Nível 2 - OBI 2016 | |
// O(n!) | |
#include <bits/stdc++.h> | |
int matriz[10][10]; | |
int main(){ | |
int n,total,subtotal=1; | |
scanf("%d",&n); | |
// calculamos (n-1)! | |
for(int i=1;i<n;i++) subtotal *= 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
// Ivan Carvalho | |
// Caminhos - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
#define MP make_pair | |
#define MAXN 5100 | |
#define PESO first | |
#define U second.first | |
#define V second.second | |
#define endl '\n' | |
using namespace std; |
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 | |
// Etiqueta - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
typedef pair<ll,ll> ii; | |
typedef pair<ll,ii> iii; | |
#define MAXN 200101 | |
#define MP make_pair | |
ll arvore[4*MAXN],lazy[4*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 | |
// Código - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
#define MAXN 100010 | |
#define LSOne(S) (S & (-S)) | |
int bit[MAXN]; | |
void update(int ind){ | |
while(ind < MAXN){ | |
bit[ind]++; | |
ind += LSOne(ind); |
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 | |
// Código Reverso - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
#define MAXN 500001 | |
#define LSOne(S) (S&(-S)) | |
int n,bit[MAXN],vetor[MAXN],exibir[MAXN]; | |
void update(int pos, int val){ | |
while(pos <= n){ | |
bit[pos] += val; | |
pos += LSOne(pos); |
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 | |
// Ilhas - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
#define MAXN 1010 | |
int U[MAXN*MAXN],V[MAXN*MAXN],reservado[MAXN],pai[MAXN],peso[MAXN],pares[MAXN]; | |
int find(int x){ | |
if (x==pai[x]) return x; | |
return pai[x] = find(pai[x]); | |
} | |
void join(int x, int y){ |
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 | |
// Secreto - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
#define MAXN 100010 | |
#define endl '\n' | |
using namespace std; | |
int visitado1[MAXN],visitado2[MAXN],grafo[MAXN],transposto[MAXN]; | |
stack<int> pilha; | |
void dfs1(int x){ | |
//cout << "Kosaraju" << endl; |
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 | |
// Superfaturamento - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
#define PESO first | |
#define U second.first | |
#define V second.second | |
#define PB push_back | |
#define MP make_pair | |
#define MAX 1001 | |
using namespace std; |
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 | |
// Jogo - Seletiva IOI - OBI 2013 | |
#include <bits/stdc++.h> | |
#define MP make_pair | |
#define PB push_back | |
#define MAX 10010 | |
#define LIMIT 1000000000 | |
#define F first | |
#define S second | |
using namespace std; |
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 | |
// Caminho - Seletiva IOI - OBI 2015 | |
#include <bits/stdc++.h> | |
#define MP make_pair | |
#define TAMANHO first | |
#define X second.first | |
#define Y second.second | |
#define MAXN 302 | |
using namespace std; | |
typedef pair<int,int> ii; |
OlderNewer