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
// Os parametros da função unlazy são: | |
// O nó atual, tl e tr, o intervalo que o nó atual abrange, | |
void unlazy(int node, int tl, int tr){ | |
// Se não houver valor a ser propagado, não precisamos propagar | |
if(lz[node] == 0) return; | |
// Primeiro, atualizamos a árvore com o novo valor | |
tree[node] = lz[node]; | |
// Se houver filhos, propagamos o vaor para eles | |
if(tl != tr){ |
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
#include<bits/stdc++.h> | |
using namespace std; | |
const int MAXN = 1e6 + 10; | |
typedef long long ll; | |
ll l[MAXN]; | |
int n; | |
int main(){ |
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
#include<bits/stdc++.h> | |
using namespace std; | |
int a, b, c, d; | |
int main(){ | |
//Primeiro, lemos a entrada | |
scanf("%d", &a); | |
scanf("%d", &b); |
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
#include<bits/stdc++.h> | |
using namespace std; | |
long long int n; | |
int main(){ | |
scanf("%lld", &n); //Lê o intero da entrada. |
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
#include<bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
const int MAXN = 1e5 + 10; | |
struct Pt { | |
ll x, y; | |
Pt(ll _x = 0, ll _y = 0) : x(_x), y(_y) {} | |
Pt operator+(const Pt& o) { return Pt(x+o.x, y+o.y); } // soma de vetores | |
Pt operator-(const Pt& o) { return Pt(x-o.x, y-o.y); } // subtração de vetores |
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
#include<bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
const int MAXN = 1e5 + 10; | |
struct Pt { | |
ll x, y; | |
Pt(ll _x = 0, ll _y = 0) : x(_x), y(_y) {} | |
Pt operator+(const Pt& o) { return Pt(x+o.x, y+o.y); } // soma de vetores | |
Pt operator-(const Pt& o) { return Pt(x-o.x, y-o.y); } // subtração de vetores |
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
struct Pt { | |
double x, y; | |
Pt(double _x = 0, double _y = 0) : x(_x), y(_y) {} | |
Pt operator+(const Pt& o) { return Pt(x+o.x, y+o.y); } // soma de vetores | |
Pt operator-(const Pt& o) { return Pt(x-o.x, y-o.y); } // subtração de vetores | |
Pt operator*(double b) { return Pt(x*b, y*b); } //retorna o vetor escalado por b | |
void operator+=(const Pt& o) { x += o.x, y += o.y; } // somar vetores com o operador += | |
void operator-=(const Pt& o) { x -= o.x, y -= o.y; } // subtrair vetores com o operador -= | |
void operator*=(double b) { x*=b, y*=b; } //retorna o vetor escalado por b | |
double dot(const Pt& o) { return x*o.x + y*o.y; } // dot - produto escalar |
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
Pt rotate(double ang /* angulo, em radianos*/){ | |
double xb = x * cos(ang) - y * sin(ang); | |
double yb = x * sin(ang) + y * cos(ang); | |
return Pt(xb,yb); | |
} |
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
#include<bits/stdc++.h> | |
using namespace std; | |
vector<int> alfabeto; //manter o alfabeto em um vector | |
vector<pair<int, int> > vogais; //guardar as vogais | |
//como vector de pair, que guarde seu indice | |
string s; | |
vector<char> ans; | |
bool isvogal(int 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
//Código por Pedro Bignotto Racchetti | |
//O(nlogn) | |
#include<bits/stdc++.h> | |
using namespace std; | |
struct Pt { | |
int x, y; | |
Pt(int _x = 0, int _y = 0) : x(_x), y(_y) {} |