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 numpy | |
from cupy.fallback_mode import numpy | |
x = numpy.array([[float('nan'), -1], [float('nan'), 1]]) # cupy.array | |
result1 = numpy.nanargmin(x, axis=1) # Converts to numpy.array, calls numpy.argmin and returns cupy.array | |
result2 = numpy.nanargmin(x) # Returns privitive int | |
print(result1) # Output: [1 1] | |
print(result2) # Output: 1 |
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 "../../lib/template/template.cpp" | |
{% if mod %} #include "../../lib/types/mod.cpp" {% endif %} | |
{% if mod %} using Mod = Modulo<{{ mod }}>; {% endif %} | |
{% if yes_str and no_str %} | |
struct yes_no : std::numpunct<char> { | |
string_type do_truename() const { return "{{ yes_str }}"; } | |
string_type do_falsename() const { return "{{ no_str }}"; } | |
}; |
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; | |
template<typename Edge> | |
vector<int> scc(const vector<vector<Edge>> &g) { | |
const int n = g.size(); | |
vector<vector<int>> rg(n); | |
vector<int> cmp(n), vs; | |
vector<bool> used(n, false); |
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
template <class T> | |
class SegmentTree { | |
const int n; | |
vector<T> data; | |
public: | |
SegmentTree(const int s) : n(1 << s), data(n * 2, T()) {} | |
void update(int p, T val) { | |
data[p += n] = val; | |
while (p /= 2) { | |
data[p] = merge(data[p * 2], data[p * 2 + 1]); |
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
template <class T> | |
class SegmentTree { | |
const int n; | |
vector<T> data; | |
T sub(int l, int r, int node, int lb, int ub) const { | |
if (ub <= l || r <= lb) return T(); | |
if (l <= lb && ub <= r) return data[node]; | |
T vl = sub(l, r, node * 2 + 0, lb, (lb + ub) / 2); | |
T vr = sub(l, r, node * 2 + 1, (lb + ub) / 2, ub); | |
return merge(vl, vr); |
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> | |
#define REP(i,n) for(int i=0;i<(int)(n);i++) | |
#define ALL(x) (x).begin(),(x).end() | |
using namespace std; | |
using ll = long long; | |
const int mod = 1000000007; |
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> | |
#define REP(i,n) for(int i=0;i<(int)(n);i++) | |
#define ALL(x) (x).begin(),(x).end() | |
using namespace std; | |
int N, M; | |
int s[16], d[128]; | |
int memo[1<<15][128]; |
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> | |
#define REP(i,n) for(int i=0;i<(int)(n);i++) | |
#define ALL(x) (x).begin(),(x).end() | |
using namespace std; | |
using ld = long double; | |
struct Edge{ int src, dest; }; |
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> | |
#define REP(i,n) for(int i=0;i<(int)(n);i++) | |
#define ALL(x) (x).begin(),(x).end() | |
using namespace std; | |
using ll = long long; | |
template <typename T> T &chmin(T &a, const T &b) { return a = min(a, b); } |
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> | |
#define REP(i,n) for(int i=0;i<(int)(n);i++) | |
#define ALL(x) (x).begin(),(x).end() | |
using namespace std; | |
vector<string> from_jfen(string s) { | |
s += "/"; | |
vector<string> res; |