Skip to content

Instantly share code, notes, and snippets.

View PedroRacchetti's full-sized avatar

Pedro Bignotto Racchetti PedroRacchetti

View GitHub Profile
#include <bits/stdc++.h>
using namespace std;
//Um pequeno dicionário, para deixar o código mais limpo
typedef long long ll;
typedef pair<int, int> pii;
#define mk(x, y) make_pair(x, y)
const int INF = 1e18;
#include <bits/stdc++.h>
using namespace std;
int n;
set<int> global;
int main() {
cin >> n;
for(int i = 1; i <= n; i++) global.insert(i); //inserimos todos os indices de 1 à n no set global
#include <bits/stdc++.h>
using namespace std;
int t, n, u, q;
long long prefixo[11234];
int main() {
scanf("%d", &t);
#include<bits/stdc++.h>
using namespace std;
const int INF = 1e9;
int distMS[512][512], dist[512][512];
int marc[512][512], marcms[512][512];
int orig[512][512];
int n, m;
#include<bits/stdc++.h>
using namespace std;
int n, minimo, total; //váriaveis usadas
int main(){
minimo = 1500; // inicializamos minimo com um valor maior que qualquer pilha.
scanf("%d", &n); //lêmos o número de pilha
for(int i = 0; i < n; i++){
int x;
scanf("%d", &x);
#include<bits/stdc++.h>
using namespace std;
const int MAX = 212345;
int w[MAX], p[MAX], n, dp[MAX][30], prof[MAX], tin[MAX];
int marc[MAX];
std::vector<int> grafo[MAX];
//Calculamos a ordem da DFS, a sparse table e a
//distancia de todas as cidades em relação à cidade 1
int T = 0;
#include<bits/stdc++.h>
using namespace std;
int orig[512][512]; //matriz original, dada na entrada.
int dx[5] = {1, 0, -1, 0};
int dy[5] = {0, 1, 0, -1}; //vetores de auxílio, que servirão como
//arestas no grafo.
int n, f;
#include<bits/stdc++.h>
using namespace std;
int marc[1123]; // o vetor de marcação
vector<int> reuniao[1123];
int n, m, I, R;
int main(){
scanf("%d %d", &n, &m);
scanf("%d %d", &I, &R);
#include<bits/stdc++.h>
using namespace std;
int orig[512][512]; //matriz original, dada na entrada.
int dx[5] = {1, 0, -1, 0};
int dy[5] = {0, 1, 0, -1}; //vetores de auxílio, que servirão como
//arestas no grafo.
int n, f;
#include <bits/stdc++.h>
using namespace std;
const int INF = 1e9 + 7; // usaremos o INF como um indicador que ainda não calculamos
// o estado. Note que não podemos usar artificios como -1
// pois a recursão aceita valores negativos
int A[212][212], pref[212][212];
int H[212][212], V[212][212];
int n, m;
int dp_ida[212][212];