Skip to content

Instantly share code, notes, and snippets.

// Update O(log(N))
// Query O(Log^2(N))
//Problema de teste : https://tinyurl.com/y95bucb5
#include <bits/stdc++.h>
#define N 100050
#define f first
#define s second
using namespace std;
typedef pair<int, int> pii;
// Wifi - OBI 2018 P2F2
// Complexidade O( N*log(N) )
#include <bits/stdc++.h>
#define N 200050
#define f first
#define s second
using namespace std;
typedef pair<int, int> pii;
// Fuga - OBI 2018 P2 F2
// Complexidade O( 2^ ceil((n*m)/4) )
#include <bits/stdc++.h>
#define N 100050
using namespace std;
int n, m, xf, yf, xo, yo, dx[4] = {1, -1, 0, 0}, dy[4] = {0, 0, 1, -1};
int ans = 0, ini[6][6];
@MatheusLealv
MatheusLealv / palindromic.cpp
Created December 26, 2017 02:45
Palindromic Partitions - CEOI 2017
// Palindromic Partitions - CEOI 2017
// Complexidade O(N)
#include <bits/stdc++.h>
#define X 145443351LL
#define mod 1000000007LL
using namespace std;
typedef long long ll;
ll Hash[1000010], n, pot[1000010];
@MatheusLealv
MatheusLealv / Bridge.cpp
Last active December 25, 2017 23:03
Building Bridge - CEOI 2017
// Building bridges - CEOI 2017
// Complexidade O(N*sqrt(N))
#include <bits/stdc++.h>
#define inf 2000000000000000000LL
#define N 100050
#define f first
#define s second
using namespace std;
typedef long long ll;
@MatheusLealv
MatheusLealv / Robots.cpp
Created December 22, 2017 02:10
Robots - IOI ' 13
// Robots - IOI 2013
// Complexidade O(T*log²(T))
#include <bits/stdc++.h>
#define f first
#define s second
#define N 1000050
#define inf 2000000010
using namespace std;
typedef pair<int, int> pii;
@MatheusLealv
MatheusLealv / Passeio.cpp
Created December 13, 2017 23:51
Passeio
// Passeio - Seletiva IOI 2013
// Complexidade O(N*log²(N))
// Matheus Leal V
#include <bits/stdc++.h>
#define mid ((a + b)/2)
#define inf 10000000
#define N 100050
#define f first
#define s second
@MatheusLealv
MatheusLealv / Risco.cpp
Last active December 13, 2017 23:48
Analise de Risco
#include <bits/stdc++.h>
#define N 100050
#define mid ((a + b)/2)
using namespace std;
typedef long long ll;
int A, B, n, v[N], tree[4*N];
int mdc(int a, int b)
{
if(!a) return b;
@MatheusLealv
MatheusLealv / Doce.cpp
Created October 18, 2017 19:05
Doce - Seletiva IOI 2014
// Doce de Banana - Seletiva IOI 2014
// Complexidade O(N*log(N))
// Matheus Leal V :D
#include <bits/stdc++.h>
#define N 100050
#define int long long
using namespace std;
int n, D[N], P[N], B[N];
@MatheusLealv
MatheusLealv / Doenca.cpp
Last active December 13, 2017 23:47
Doença
// Doença - Seletiva IOI 2015
// Complexidade O(N*log(N))
// Matheus Leal V
#include <bits/stdc++.h>
#define N 100050
using namespace std;
int n, Viz[N], Tempo[N][2], resp;
bool doente[N];