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> | |
using namespace std; | |
#if DEBUG && !ONLINE_JUDGE | |
#define debug(args...) (Debugger()) , args | |
class Debugger { | |
public: | |
Debugger(const string sep = " | ") : first(1), sep(sep) {} | |
template <typename T> Debugger& operator , (const T& arg) { | |
if (first) first = false; | |
else cerr << sep; |
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
# Extracted from https://www.kaggle.com/danbrice/keras-plot-history-full-report-and-grid-search | |
import matplotlib.pyplot as plt | |
def plot_history(history): | |
loss_list = [s for s in history.history.keys() if 'loss' in s and 'val' not in s] | |
val_loss_list = [s for s in history.history.keys() if 'loss' in s and 'val' in s] | |
acc_list = [s for s in history.history.keys() if 'acc' in s and 'val' not in s] | |
val_acc_list = [s for s in history.history.keys() if 'acc' in s and 'val' in s] | |
if len(loss_list) == 0: | |
print('Loss is missing in history') |
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
// http://codeforces.com/blog/entry/53170 | |
#include <bits/stdc++.h> | |
using namespace std; | |
#define N 100005 | |
#define eb emplace_back | |
int n, u, v, q; | |
int sz[N], in[N], rin[N], out[N], chain[N], t; | |
vector <int> adj[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 _ ios_base::sync_with_stdio(0); | |
#define endl '\n' | |
using namespace std; | |
#define inf ((int)1e9) | |
typedef pair <int, int> base; |
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
// Erdős–Gallai theorem | |
// Gives a necessary and sufficient condition for a finite sequence | |
// of natural numbers to be the degree sequence of a simple graph. | |
// Must be sorted in non-increasing order. | |
// Popularidade no Facebook: https://www.urionlinejudge.com.br/judge/pt/problems/view/1462 | |
#include<bits/stdc++.h> | |
using namespace std; | |
#define int long long |
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
// http://codeforces.com/group/kZPk3ZTzR5/contest/101041/problem/D | |
// Nome do problema: Investigating the cartel | |
// Descrição: Quantos elementos com frequência maior que 1 no intervalo | |
// https://www.codepit.io/#/problems/5369c356f6fa9de49e5c7fa3/view | |
// Nome do problema: D-query | |
// Descrição: Quantos elementos diferentes no intervalo | |
// Resolve consultas em O((N+Q)*sqrt(N)+Q*log(Q)) | |
#include <bits/stdc++.h> |
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> | |
using namespace std; | |
#define N 1000 | |
bool hasDigitRegex(string& s) { | |
return regex_search(s, regex("[0-9]")); | |
} | |
bool hasDigitNormal(string& s) { | |
for (int i = 0; i < (int)s.size(); i++) { |
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
from random import randint | |
CPU_FACIL = "CPU (fácil)" | |
CPU_DIFICIL = "CPU (difícil)" | |
jogador = ["", ""] | |
simbolo = ["X", "O"] | |
def mostraTelaJogo(raw_tabuleiro): | |
print("-----------------") | |
print("{} vs {}".format(jogador[0], jogador[1])) | |
tabuleiro = [x if x else " " for x in raw_tabuleiro] |
NewerOlder