Skip to content

Instantly share code, notes, and snippets.

View algon-320's full-sized avatar
😎

Jun Ishiguro algon-320

😎
  • Google
  • Tokyo, Japan
  • 03:55 (UTC +09:00)
View GitHub Profile
@algon-320
algon-320 / BearNSWE.cpp
Last active July 29, 2016 13:02
SRM 695 easy
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);i++)
#define FORE(x,arr) for(auto &x:arr)
#define FOR(i,a,n) for(int i=a;i<(int)(n);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
@algon-320
algon-320 / ECR15A.cpp
Last active July 30, 2016 11:05
Educational Codeforces Round #15
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);i++)
#define FOR(i,a,n) for(int i=a;i<(int)(n);i++)
#define FORE(x,arr) for(auto &x:arr)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
@algon-320
algon-320 / UpDownNess.cpp
Created August 4, 2016 15:10
SRM 694 Div2 Hard.
#include <bits/stdc++.h>
using namespace std;
typedef pair<int,int> pii;
typedef long long ll;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);i++)
#define FORE(x,arr) for(auto &x:arr)
#define FOR(i,a,n) for(int i=a;i<(int)(n);i++)
#define REP(i,n) FOR(i,0,n)
#define ALL(c) begin(c),end(c)
const int DX[4]={0,1,0,-1}, DY[4]={-1,0,1,0};
#include <bits/stdc++.h>
using namespace std;
#define int long long
using ll=long long;
using vi=vector<int>;
using vl=vector<long long>;
using pii=pair<int,int>;
using pll=pair<long long,long long>;
#define ITR(i,c) for(auto i=begin(c);i!=end(c);++i)
#define FORE(x,c) for(auto &x:c)
@algon-320
algon-320 / wave.cpp
Last active May 8, 2017 13:56
WAVファイルを書き出す (c++版)
#include <iostream>
#include <vector>
#include <string>
#include <cstring>
#include <fstream>
#include <cmath>
// 44100 Hz / 16 bit / ステレオ のリニアPCM
#define SAMPLING_RATE (44100)
@algon-320
algon-320 / fizzfuzz.tex
Created May 9, 2017 14:13
TeXでFizzBuzz
\documentclass{jarticle}
\makeatletter
\newcount \xx@res
\def\remainder#1#2{
\newcount \xx@a
\xx@a = #1
\divide \xx@a #2
\multiply \xx@a -#2
\advance \xx@a #1
\xx@res = \xx@a
#include <bits/stdc++.h>
using namespace std;
string reverseChallenge(string s) {
string t, ans;
vector<int> len;
int l = 0;
s += ' ';
for(size_t i = 0; i < s.size(); i++) {
if(s[i]==' ') {
@algon-320
algon-320 / srm717div2hard.cpp
Last active July 1, 2017 01:29
DerangementsDiv2
#include <bits/stdc++.h>
using namespace std;
static const int MOD = 1000000007;
struct DerangementsDiv2 {
long long bin_pow_mod(long long x,long long y) {
if(x==0) return 0;
long long prod=1;
while(y>0) {
#include <bits/stdc++.h>
using namespace std;
struct NiceTable {
string isNice(vector<string> t) {
int n=t.size();
int m=t[0].size();
for(int x=0; x<(1<<n); x++) {
for(int y=0; y<(1<<m); y++) {
bool ok=true;
#include <bits/stdc++.h>
using namespace std;
struct LexmaxReplace {
string get(string s, string t) {
sort(begin(t), end(t));
reverse(begin(t), end(t));
int n=s.size();
int idx=0;
for(int i=0; i<n; i++) {