This file contains hidden or 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 | |
| // Picture - International Olympiad in Informatics 1998 | |
| // ioi98p4 - https://dmoj.ca/problem/ioi98p4 | |
| // O(n*log(n)) | |
| #include <bits/stdc++.h> | |
| #define MT make_tuple | |
| using namespace std; | |
| typedef tuple<int,int,int,int> quadra; | |
| const int MAXN = 20100; | |
| const int ADD = 10001; |
This file contains hidden or 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 | |
| // Pedras - Seletiva IOI - OBI 2015 | |
| // Alternative Solution - O(n*sqrt(n)) | |
| #include <bits/stdc++.h> | |
| using namespace std; | |
| const int MAXN = 1e5 + 10; | |
| const int BUCKET = 318; | |
| vector<int> ida; | |
| int freq[BUCKET][MAXN],tempfreq[MAXN],versao[MAXN],divisao[MAXN],vetor[MAXN],iteracao,N,Q; | |
| int precalc[BUCKET][BUCKET]; |
This file contains hidden or 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 | |
| // Doodle - Seletiva IOI - OBI 2015 | |
| // O(n*log^2(n)) | |
| #include <bits/stdc++.h> | |
| #define MP make_pair | |
| #define F first | |
| #define S second | |
| #define LSOne(S) (S & (-S)) | |
| using namespace std; | |
| typedef pair<int,int> point; |
This file contains hidden or 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 | |
| // Mars Map - Baltic Olympiad in Informatics 2001 | |
| // NKMARS - http://www.spoj.com/problems/NKMARS/ | |
| // O(n*log(n)) | |
| #include <bits/stdc++.h> | |
| #define MP make_pair | |
| using namespace std; | |
| typedef pair<int,int> i2;typedef pair<int,i2> i3;typedef pair<int,i3> i4; | |
| const int MAXN = 3*1e4 + 10; | |
| vector<i4> sweep; |
This file contains hidden or 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 | |
| // Cortando o Papel - Fase 2 Programação Nível 2 - OBI 2017 | |
| // O(n*log(n)) | |
| #include <bits/stdc++.h> | |
| using namespace std; | |
| typedef pair<int,int> ii; | |
| vector<ii> papel; | |
| int estado[100010],n,tiras,resp; | |
| int main(){ | |
| scanf("%d",&n); |
This file contains hidden or 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 <bits/stdc++.h> | |
| #define MP make_pair | |
| using namespace std; | |
| typedef pair<int,int> ii; | |
| typedef pair<int,ii> iii; | |
| inline bool compara(ii x,ii y){return x.first > y.first;} | |
| vector< vector<ii> > pai,valores; | |
| vector<int> peso; | |
| vector<iii> Kruskal; | |
| int find(int x,int kth){ |
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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; |