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
#define INF 1000000007 | |
int read_mod(string num) | |
{ | |
int ret = 0; | |
for (auto i = num.begin(); i != num.end(); i++) { | |
ret = (ret * 10 + (int)(*i) - '0') % INF; | |
} | |
return ret; | |
} |
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
/* | |
A cache is a component that stores data so future requests for that data can be served faster. The data stored in a cache might be the results of an earlier computation, or the duplicates of data stored elsewhere. A cache hit occurs when the requested data can be found in a cache, while a cache miss occurs when it cannot. Cache hits are served by reading data from the cache which is faster than recomputing a result or reading from a slower data store. Thus, the more requests that can be served from the cache, the faster the system performs. | |
One of the popular cache replacement policies is: "least recently used" (LRU). It discards the least recently used items first. | |
*/ | |
#include <iostream> | |
#include <vector> | |
#include <map> | |
#include <string> |
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 <stdexcept> | |
using namespace std; | |
class Matrix { | |
public: | |
Matrix(int, int); | |
Matrix(); | |
~Matrix(); | |
Matrix(const Matrix&); | |
Matrix& operator=(const Matrix&); |
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
<div class="flex h-screen w-full items-center justify-center overflow-hidden bg-gray-900 group"> | |
<div class="aspect-square w-72 overflow-hidden rounded-full bg-coin-head group-hover:animate-coin-flip"></div> | |
</div> |
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 <algorithm> | |
const int n = 10; | |
const int MAX = 100000; | |
int a[n]; | |
void print() | |
{ | |
for (int i = 0; i < n; 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
#include <iostream> | |
using namespace std; | |
class AttackFunctionObject | |
{ | |
public: | |
virtual void operator()(int damage) | |
{ | |
printf("attack\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
#include "stdafx.h" | |
#include <iostream> | |
#include <thread> | |
#include <mutex> | |
using namespace std; | |
int thread_count = 0; | |
const int max_thread = 200; | |
const int n = 200000; | |
int a[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
void insertion_sort(vector<int>& a, int& value) { | |
a.insert(upper_bound(a.begin(), a.end(), value), value); | |
} |
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
// precondition: a & b are both sorted | |
bool overlap(vector<string>& a, vector<string>& b) { | |
auto i = a.begin(); | |
auto j = b.begin(); | |
auto n = upper_bound(i, a.end(), *b.rbegin()); | |
auto m = upper_bound(j, b.end(), *a.rbegin()); | |
while(i < n && j < m) { | |
if(*i == *j) { | |
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
#include <bits/stdc++.h> | |
using namespace std; | |
void solve() { | |
} | |
int main() { | |
int t; | |
cin>>t; |