Skip to content

Instantly share code, notes, and snippets.

@junodeveloper
junodeveloper / cht.cpp
Last active May 18, 2020 05:09
Convex Hull Trick using STL::set
// max cht (integer type query)
// Usage:
// Insert: cht.insert({a,b})
// Query: cht.query(x)
struct CHT {
using ll=__int128;
using Line=pair<ll,ll>;
using Point=pair<ll,Line>;
const ll INF=1e15;
set<Line> line_set;
@junodeveloper
junodeveloper / main.cpp
Created April 3, 2020 09:04
chess ai (minimax alg. ver.)
/* 2016.01.20
Chess AI by junodeveloper
Notes:
- Promotion is not implemented.
- Only used minimax algorithm (not alpha-beta prunning).
*/
#include <stdio.h>
#include <stdlib.h>
#include <string>
#version 330 core
out vec4 FragColor;
struct Material {
sampler2D diffuse;
sampler2D specular;
float shininess;
};
struct DirLight {
@junodeveloper
junodeveloper / fs.fs
Created March 21, 2019 08:42
InActivity 2
#version 330 core
out vec4 FragColor;
in vec3 ourColor;
void main()
{
FragColor = vec4(ourColor, 1.0f);
}
@junodeveloper
junodeveloper / opencv_load_folder.cpp
Created January 8, 2019 06:08
OpenCV load images from a folder
#include "opencv2/opencv.hpp"
#include <iostream>
#include <string>
using namespace cv;
using namespace std;
int main(int, char**)
{
cv::String path("*.png");
@junodeveloper
junodeveloper / agc028_c.cpp
Created October 14, 2018 04:46
AGC028. Problem C
#include <bits/stdc++.h>
#define sz(x) ((int)x.size())
#define all(x) (x).begin(), (x).end()
using namespace std;
typedef long long ll;
typedef long double ld;
int n, A[100010], B[100010], P[100010][2];
ll s[200010];
vector<pair<int,int> > v;
int main() {
@junodeveloper
junodeveloper / commando.cpp
Last active September 18, 2018 04:20
APIO 2014 Commando with CHT
#include <bits/stdc++.h>
using namespace std;
struct line {
long long a, b;
};
vector<line> S;
double cross(line L1, line L2) {
if(L1.a == L2.a) return L1.b <= L2.b ? -1e18 : 1e18;
return (double)(L1.b - L2.b) / (L2.a - L1.a);
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <queue>
#include <utility>
using namespace std;
queue< pair < int , int > > q;
int memo[100001][4] , A , B;
@junodeveloper
junodeveloper / koi_resort_edit1.cpp
Last active May 21, 2018 06:59
KOI 리조트 첨삭1
#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
int min( int a , int b)
{
return a>b ? b : a;
}
#include<cstdio>
#include<algorithm>
using namespace std;
int a[10],c[11][11],n; // c : 조합
int main() {
scanf("%d",&n);
for(int i=0;i<=10;i++) c[i][0]=c[i][i]=1;
for(int i=1;i<=10;i++) for(int j=1;j<i;j++) c[i][j]=c[i-1][j]+c[i-1][j-1];
if(n<1023) {
int k=1,s=0; // k : 자릿수, s : k자리 이하의 감소하는 수 개수