I hereby claim:
- I am terror on github.
- I am terror (https://keybase.io/terror) on keybase.
- I have a public key whose fingerprint is F47B 950C BC83 1286 3C74 F850 2D1C 94B5 AE64 3A19
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
#include <bits/stdc++.h> | |
using namespace std; | |
typedef long long ll; | |
typedef long double ld; | |
typedef unsigned int uint; | |
typedef unsigned long long ull; | |
typedef vector<int> vi; | |
typedef vector<ll> vl; |
import sys | |
for i in sys.stdin: | |
if i.rstrip() == '': | |
break | |
i = int(i) | |
s = [] | |
q = [] | |
pq = [] |
from heapq import heappush, heappop | |
n, t = list(map(int, input().split())) | |
people = {} | |
for i in range(n): | |
a, b = list(map(int, input().split())) | |
if b in people: | |
people[b].append(a) | |
else: |
class PriorityQueue: | |
def __init__(self): | |
self.elements = [] | |
# add element to queue | |
def enqueue(self, element): | |
self.elements.append(element) | |
# poll and return element based on priority | |
# note that this is max pq |
import heapq | |
items = [1,2,3,4,5] | |
pq = [] | |
# Push element onto the heap (adding) | |
# Note that heapq is min heap by default so smallest element gets max priority | |
for i in items: | |
heapq.heappush(pq,i) | |
import queue | |
items = [1,2,3,4,5] | |
q = queue.Queue() | |
# Enqueue elements | |
for i in items: | |
q.put(i) | |
# Dequeue and return element from the queue |
class Queue: | |
def __init__(self): | |
self.elements = [] | |
def enqueue(self, element): | |
self.elements.insert(0,element) | |
def dequeue(self): | |
return self.elements.pop() | |