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
use std::{collections::HashMap, vec}; | |
type Table = HashMap<String, Vec<String>>; | |
fn show(table: &Table) { | |
for (artist, works) in table { | |
println!("works by {}:", artist); | |
for work in works { | |
println!(" {}", work); | |
} | |
} |
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 pkgutil | |
# List all available modules | |
available_modules = [module.name for module in pkgutil.iter_modules()] | |
available_modules |
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
struct MakingRegularGraph { | |
int n; | |
vector<int> x, y, deg; | |
set<int> rest; | |
set<pair<int, int>> edge; | |
void dfs(vector<int> &ans) { | |
if (rest.size() == 0) { | |
return ; | |
} else if (rest.size() == 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 <stdio.h> | |
#include <stdlib.h> | |
#include <assert.h> | |
#include "heap.h" | |
Heap *initHeap(int maxSize) { | |
Heap *h = malloc(sizeof(Heap)); | |
if (h == NULL) { | |
return NULL; |
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 <stdio.h> | |
#include <limits.h> | |
unsigned int getbits(unsigned int x, int p, int n); | |
unsigned int setbits(unsigned int x, int p, int n, unsigned int y); | |
void print_bits(unsigned int x); | |
int main() { | |
print_bits(setbits((1 << 5) - 1, 3, 3, 10)); // x = 11111, y = 1010 => 10101 |
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; | |
typedef long long int ll; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
#define ALL(c) c.begin(), c.end() | |
#define UNIQUE(c) sort(ALL(c)), c.erase(unique(ALL(c)), c.end()) | |
const int INF = INT_MAX; |
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; | |
#define FOR(i,s,x) for(int i=s;i<(int)(x);i++) | |
#define REP(i,x) FOR(i,0,x) | |
struct DisjointSet { | |
vector<int> parent, rank; | |
DisjointSet(int 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
# 予選Aで日本人60位までが通過したという情報を元にしたランキング | |
# 日本人順位(全体順位): ハンドルネーム | |
# 通過済みの日本人順位は--としている | |
--(4): yutaka1999 | |
--(22): tozangezan | |
--(23): mcfx | |
1(24): DEGwer | |
2(32): yokozuna57 | |
3(33): sugim48 | |
--(34): kmjp |
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 sequtils, strutils, algorithm | |
type | |
FenwickTree[T] = object | |
dat: seq[T] | |
size: int | |
initial: T | |
proc initFenwickTree[T](size: int, initial: T): FenwickTree[T] = | |
assert(size > 0) |
NewerOlder