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 Conv { | |
ll cursor = 0; | |
map<ll, ll> to_short; // <original, small > | |
map<ll, ll> to_long; // <small, original> | |
std::set<ll> tmp; | |
bool build_end = false; | |
void set(ll original) { | |
if (to_short.find(original) != to_short.end()) { |
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
// startは含む | |
// endは含まない | |
RangeCount range_count(vector<int>::iterator start, vector<int>::iterator end, int l, int r) { | |
if (l > r) return RangeCount{0, 0, 0, 0, 0}; | |
if (start >= end) return RangeCount{0, 0, 0, 0, 0}; | |
if (l == r) { | |
RangeCount rc; | |
auto it_u = upper_bound(start, end, r); |
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 Order { | |
vector<int> v; | |
vector<int> order; | |
public: | |
Order(vector<int> &v) : v(v), order(v.size()) { | |
vector<P> tmp(v.size()); | |
rep(i, v.size()) { | |
tmp[i].first = v[i]; | |
tmp[i].second = i; | |
} |
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 Keta { | |
vector<int> digits; | |
public: | |
Keta(ll i) : digits(i == 0 ? 1 : log10(i) + 1) { | |
for (int k = 0; k < digits.size(); k++) { | |
digits[k] = i % 10; | |
i /= 10; | |
} |
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 Triangle { | |
int parent; | |
vector<int> children; | |
}; | |
class Tree { | |
vector<vector<int>> edges; | |
public: | |
Tree(int n) : edges(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
#!/usr/bin/env ruby | |
require "socket" | |
require 'thwait' | |
server = TCPServer.open(3000) | |
htmlsoc = server.accept | |
threads = [] |
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
#!/usr/bin/env ruby | |
require "socket" | |
require 'thwait' | |
server = TCPServer.open(3000) | |
htmlsoc = server.accept | |
threads = [] |
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
#!/usr/bin/env ruby | |
require "socket" | |
require 'thwait' | |
server = TCPServer.open(3000) | |
htmlsoc = server.accept | |
threads = [] |
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 Video { | |
String videoID; | |
} | |
class User { | |
String userID; | |
} | |
class PlayEvent { | |
String userID; |
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 Video { | |
String videoID; | |
List<String> playedUsers; | |
} | |
class User { | |
String userID; | |
List<String> playedVideos; | |
} |
NewerOlder