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
from typing import List | |
from sortedcontainers import SortedList | |
# Write any import statements here | |
def getMinExpectedHorizontalTravelDistance(N: int, H: List[int], A: List[int], B: List[int]) -> float: | |
conveyors = get_conveyors(H, A, B) | |
find_conveyors_below(conveyors) | |
find_init_probs(conveyors) | |
find_total_probs(conveyors) |
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 <iostream> | |
#include <string> | |
#include <set> | |
#include <vector> | |
using namespace std; | |
// Write any include statements here | |
struct Conveyor { | |
int height, left, right; | |
double init_prob, prob; |
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; | |
// Write any include statements here | |
#define MAXN 4000200 | |
long long bit[2 * MAXN]; | |
void bit_upd(int idx, long long v) { | |
while (idx < 2 * MAXN) { |
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
from typing import List | |
from heapq import heappush, heappop | |
# Write any import statements here | |
def getPlusSignCount(N: int, L: List[int], D: str) -> int: | |
# Write your code here | |
horizontal_lines, vertical_lines = get_lines(L, D) | |
merged_hor_lines = get_merged_lines(horizontal_lines) |
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; | |
#define MAXN 1010 | |
#define F first | |
#define S second | |
typedef pair<int,int> ii; |
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
// Segredo do Cofre - F1P1 - OBI 2017 | |
// Rogério Júnior | |
// O(N+M) | |
#include <cstdio> // scanf e printf | |
#include <algorithm> // min e max | |
using namespace std; | |
#define MAXN 100100 // defino o valor de MAXN |
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
// Teleférico - F1P1 - OBI 2017 | |
// Rogério Júnior | |
// Complexidade: O(1) | |
#include <cstdio> // scanf e printf | |
int main(){ | |
// declaro e leio os valores de C e A | |
int c, a; |
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
// Drone de Entrega - F1PJ - OBI 2017 | |
// Rogério Júnior | |
// Complexidade: O(1) | |
#include <cstdio> // scanf e printf | |
int main(){ | |
// declaro e leio os valores de A, B, C, H e L | |
int a, b, c, h, l; |
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
// Bondinho - F1PJ - OBI 2017 | |
// Rogério Júnior | |
// Complexidade: O(1) | |
#include <cstdio> // scanf e printf | |
int main(){ | |
// declaro e leio os valores de A e M | |
int a, m; |
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
// Rogerio Junior - @rogerioagjr | |
// Basic Treap | |
#include <bits/stdc++.h> | |
using namespace std; | |
struct node{ | |
int v, w; |
NewerOlder