Skip to content

Instantly share code, notes, and snippets.

@cthbst
cthbst / index.html
Last active July 21, 2020 08:48
scoreboard
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>no title</title>
<style>
.verdict-accepted {
color: #0a0;
font-weight: bold;
}
@cthbst
cthbst / README.md
Last active September 21, 2020 10:11

APCS 2020/07/04 by cthbst

pA

  • 用 std::map 或是一個範圍至少有 100 的陣列,記錄每一種數字的出現次數
  • time: O(100 * T + length)

pB

  • 用 struct 儲存每一面目前的點數
  • 每次修改操作直接呼叫對應的修改函式
  • time: O(n + m)
#include <bits/stdc++.h>
using namespace std;
int B(int x) {
x = ((x >> 16) | x) & 0xFFFF;
x = ((x >> 8) | x) & 0xFF;
x = ((x >> 4) | x) & 0xF;
x = ((x >> 2) | x) & 0x3;
x = ((x >> 1) | x) & 0x1;
return x;
struct { // WindDirection 監測風向
/* 由 23456789 腳, 其中第2腳為正北方
* 換成角度的話
* 2 = 0度
* 3 = 45度
* 4 = 90度
* 5 = 135度
* 6 = 180度
* 7 = 225度
import sys
cnt = 0
buf = []
def get_input():
try:
tbuf = input().split()
except:
raise Exception("No inputs")
"""Stuff that differs in different Python versions and platform
distributions."""
from __future__ import absolute_import, division
import os
import sys
from pip._vendor.six import text_type
try:
@cthbst
cthbst / 100519H.cpp
Created February 27, 2018 01:25
solution
#include<stdio.h>
#include<stdlib.h>
#include<string.h>
#include<iostream>
#include<algorithm>
#include<vector>
using namespace std;
int n,m,k;
vector<int> outgo[1010];
bool visit[1010];
@cthbst
cthbst / .gitignore
Last active February 11, 2018 04:25
*.out
@cthbst
cthbst / main.cpp
Created September 21, 2017 12:07
puzzle wall
#include <bits/stdc++.h>
using namespace std;
const int MAXN = 100;
int n, m, cnt=0;
int G[MAXN][MAXN];
int dx[] = {0,1};
int dy[] = {1,0};
bool ok(int x, int y){
#include <msgpack.hpp>
#include <iostream>
#include <fstream>
#include <vector>
#include <string>
#include <sstream>
#include <queue>
using namespace std;
void finput(const string& filename, vector<string>& );