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 <climits> | |
#include <vector> | |
#include <string> | |
using namespace std; | |
int arr[8][8] = { 0, }; // 처음 방안의 벽과 cctv의 위치 배열 | |
int range[8][8] = { 0, }; // cctv의 동작반경 | |
int N, M; // N * M: 배열크기, C: cctv 갯수 | |
vector< pair<int, int> > cctv; // cctv의 배열 |
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
promos = [globals()[name] for name in globals() | |
if name.endswith('_promo') | |
and name != 'best_promo'] | |
def best_promo(order): | |
return max(promo(order) for promo in promos) |
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 abc import ABC, abstractmethod | |
from collections import namedtuple | |
Customer = namedtuple('Customer', 'named fidelity') | |
class LineItem: | |
def __init__(self, product, quantity, price): | |
self.product = product | |
self.quantity = quantity |
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 abc import ABC, abstractmethod | |
from collections import namedtuple | |
Customer = namedtuple('Customer', 'named fidelity') | |
class LineItem: | |
def __init__(self, product, quantity, price): | |
self.product = product | |
self.quantity = quantity |
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
import time | |
from threading import Thread | |
COUNT = 50000000 | |
def countdown(n): | |
while n>0: | |
n -= 1 | |
t1 = Thread(target=countdown, args=(COUNT//2,)) |
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
import time | |
from threading import Thread | |
COUNT = 50000000 | |
def countdown(n): | |
while n>0: | |
n -= 1 | |
start = time.time() |
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 <vector> | |
using namespace std; | |
int arr[100][100] = {0, }; | |
int N, L; | |
bool check_slope(vector<int> &v){ | |
// 모든 칸의 높이가 같은 경우 true 반환 | |
bool same = true; |
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 <stdio.h> | |
#define MAX_N 100001 | |
typedef struct { | |
int first; | |
int second; | |
} pii; | |
struct pq{ | |
pii heap[MAX_N]; | |
int index[MAX_N]; |
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
class Solution { | |
private: | |
bool hash[500001] = {0, }; | |
public: | |
int firstMissingPositive(vector<int>& nums) { | |
int cnt; | |
for (int i=0; i<nums.size(); i++){ | |
if(nums[i] <= 0 || nums[i] > nums.size()) continue; | |
else hash[nums[i]] = true; | |
} |
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 Data{int idx; int value;}; | |
Data db[MAX_N]; | |
int pri[MAX_N]; | |
priority_queue<pair<int, Data*>> PQ; | |
void find(){ | |
while(!PQ.empty()){ | |
int pri = PQ.top().first; | |
Data *p = PQ.top().second; | |
PQ.pop(); |
NewerOlder