-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from tr1ten/dev
Fix: Slow api fetching & releases
- Loading branch information
Showing
9 changed files
with
200 additions
and
2 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: Create Release | ||
|
||
jobs: | ||
build: | ||
name: Create Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
body: | | ||
Regular release. | ||
draft: false | ||
prerelease: false |
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#include <iostream> | ||
#include <vector> | ||
#include <algorithm> | ||
#include <numeric> | ||
#include <cstring> | ||
|
||
using namespace std; | ||
|
||
const long long MOD = 1e9+7; | ||
const long long INF = 1e10+5; | ||
|
||
// Function to get sum from r1,c1 to r2,c2 from ps | ||
long long get_sum(int r1, int c1, int r2, int c2, const vector<vector<long long>>& ps) { | ||
return ps[r1][c1] - (ps[r1][c2+1] + ps[r2+1][c1]) + ps[r2+1][c2+1]; | ||
} | ||
|
||
// Function to fill the prefixes and check if x is ok | ||
bool is_ok(long long x, int n, const vector<vector<int>>& mat, vector<vector<long long>>& pref) { | ||
// Reset and fill the prefixes | ||
for (auto& v : pref) memset(&v[0], 0, sizeof(long long)*v.size()); | ||
for (int i = n-1; i >= 0; i--) { | ||
for (int j = n-1; j >= 0; j--) { | ||
pref[i][j] = (mat[i][j] <= x) + pref[i+1][j] + pref[i][j+1] - pref[i+1][j+1]; | ||
} | ||
} | ||
return 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
const long double eps = 1e-7; | ||
|
||
int main(int argc, char const *argv[]) | ||
{ | ||
double l = 0.0f, r=1e4f; | ||
|
||
double ans = -1; | ||
int ic = 10000; | ||
for (int i = 0; i < ic && l + eps < r; ++i) | ||
{ | ||
float mid = 0.5f * (l + r); | ||
if (ok(mid)){ | ||
r = mid; | ||
ans = mid;} | ||
else | ||
l = mid; | ||
} | ||
return 0; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
const int N = 1e5+5; | ||
vector<vector<int>> divs(N+1); | ||
// find prime <sqrt(MAX) | ||
// O(LlogL) | ||
void preprocess(){ | ||
for(int x=2;x<=N;x++){ | ||
for(int u=x;u<=N;u +=x){ | ||
divs[u].push_back(x); | ||
} | ||
} | ||
} | ||
vector<long long> divisors(long long x){ | ||
vector<long long> cur; | ||
for(int j=1;j*j<=x;j++) | ||
{ | ||
if(x%j==0) | ||
{ | ||
cur.push_back(j); | ||
if(j != x/j) | ||
cur.push_back(x/j); | ||
} | ||
} | ||
return cur; | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
#include <bits/stdc++.h> | ||
|
||
using namespace std; | ||
|
||
|
||
class HashedString { | ||
private: | ||
// change M and B if you want | ||
static const long long M = 1e9 + 7; | ||
static const long long B = 9973; | ||
|
||
// pow[i] contains B^i % M | ||
static vector<long long> pow; | ||
|
||
// p_hash[i] is the hash of the first i characters of the given string | ||
vector<long long> p_hash; | ||
|
||
public: | ||
HashedString(const string &s) : p_hash(s.size() + 1) { | ||
while (pow.size() < s.size()) { pow.push_back((pow.back() * B) % M); } | ||
|
||
p_hash[0] = 0; | ||
for (int i = 0; i < s.size(); i++) { | ||
p_hash[i + 1] = ((p_hash[i] * B) % M + s[i]) % M; | ||
} | ||
} | ||
|
||
long long getHash(int start, int end) { | ||
long long raw_val = | ||
(p_hash[end + 1] - (p_hash[start] * pow[end - start + 1])); | ||
return (raw_val % M + M) % 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
#include <iostream> | ||
|
||
using namespace std; | ||
|
||
const long long MOD = 1e9+7; | ||
const long long INF = 1e10+5; | ||
|
||
const int N = 1000 + 5; | ||
long long fact[N]; | ||
long long inv[N]; | ||
long long finv[N]; | ||
|
||
void pre() { | ||
fact[0] = 1; | ||
for (int i = 1; i <= N; i++) { | ||
fact[i] = (fact[i-1]*i)%MOD; | ||
} | ||
inv[1] = 1; | ||
for (int i = 2; i <= N; i++) { | ||
inv[i] = 1LL * (MOD - MOD / i) * inv[MOD % i] % MOD; | ||
} | ||
finv[0] = finv[1] = 1; | ||
for (int i = 2; i <= N; i++) { | ||
finv[i] = (inv[i]*finv[i-1])%MOD; | ||
} | ||
} | ||
|
||
long long nCk(int n,int k) { | ||
return (((fact[n]*finv[k])%MOD)*finv[n-k])%MOD; | ||
} | ||
|
||
int main(int argc, char const *argv[]) { | ||
pre(); | ||
cout << nCk(10,2); | ||
return 0; | ||
} |
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
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