Skip to content

Instantly share code, notes, and snippets.

// Noic - Ideia 4
// Exercício 1
// Complexidade: O(N^2)
// Por Leonardo Paes
#include <bits/stdc++.h>
using namespace std;
int v[1000100];
// Noic - Ideia 4
// Exercício 1
// Complexidade: O(N)
// Por Leonardo Paes
#include <bits/stdc++.h>
using namespace std;
int v[1000100];
// Noic - Ideia 4
// Exercício 2
// Complexidade: O(N)
// Por Leonardo Paes
#include <bits/stdc++.h>
using namespace std;
int v[3000000];
// Noic - Iniciante - Semana 55 - Problema 2
// O(N)
#include <bits/stdc++.h>
using namespace std;
int main(){
//um representa a quantidade de 1's, e dois a quantidade de 2's
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 1e5 + 100;
const long long mod = 1e9+7;
vector<int> grafo[MAXN];
#include <bits/stdc++.h>
using namespace std;
const int maxn = 2e5+100;
int vet[maxn], resp[maxn], ind[maxn], pre[maxn], nex[maxn];
struct nod{
int v, d;
#include <bits/stdc++.h>
using namespace std;
int main(){
int n, m;
cin >> n >> m;
vector<int> a(n), b(m);
#include <bits/stdc++.h>
using namespace std;
const int maxn = 5e2 + 100; // Número máximo de caracteres da string S.
int n, dp[maxn][maxn]; // Declaro N e a DP.
string s; // Declaro a string S.
// Os parametros da função build são:
// O índice do nó atual, o l e o r do intervalo representado pelo nó.
void build(int node, int l, int r){
// Se o nó atual é uma folha:
// O valor desse nó é simplesmente vet[l], ou vet[r], e então retorno a função.
if(l==r){
tree[node]=vet[l];
return;
}
// Caso contrário, declararemos mid como o índice que divide o nó atual em duas metades.
// Os parametros da função Update são:
// O nó atual, tl e tr, o intervalo que o nó atual abrange, idx e x, o índice que queremos atualizar e o seu valor.
void update(int node, int tl, int tr, int idx, int x){
// Se o nó atual é uma folha, então ele representa o intervalo de idx até idx.
// Então, atualizaremos o seu valor e retornaremos a função.
if(tl==tr){
tree[node]=x;
vet[l]=x;
return;
}