This file contains hidden or 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
# begin input | |
N = 100000 | |
K = 100 | |
arr = Array.new(N){rand(0..(K*2))} | |
p arr | |
# end input |
This file contains hidden or 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
#pragma GCC optimize ("O3") | |
#pragma GCC target ("avx") | |
#include "bits/stdc++.h" | |
using namespace std; | |
typedef long long int ll; | |
#define debug(v) {printf("L%d %s > ",__LINE__,#v);cout<<(v)<<endl;} | |
#define debugv(v) {printf("L%d %s > ",__LINE__,#v);for(auto e:(v)){cout<<e<<" ";}cout<<endl;} | |
#define debuga(m,w) {printf("L%d %s > ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;} |
This file contains hidden or 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
#pragma GCC optimize ("O3") | |
#pragma GCC target ("avx") | |
#include "bits/stdc++.h" // define macro "/D__MAI" | |
using namespace std; | |
typedef long long int ll; | |
#define debug(v) {printf("L%d %s > ",__LINE__,#v);cout<<(v)<<endl;} | |
#define debugv(v) {printf("L%d %s > ",__LINE__,#v);for(auto e:(v)){cout<<e<<" ";}cout<<endl;} | |
#define debuga(m,w) {printf("L%d %s > ",__LINE__,#m);for(int x=0;x<(w);x++){cout<<(m)[x]<<" ";}cout<<endl;} |
This file contains hidden or 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
require 'fileutils' | |
fileinfo = [["0test",5],["1simple",10],["5extreme",10]] | |
fileinfo.each{|name,count| | |
count.times{|index| | |
FileUtils.touch(sprintf("%s%02d.txt",name,index)) | |
} | |
} |
This file contains hidden or 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
module BWT | |
module_function | |
def convert(str) | |
(0...str.size).to_a.sort!{|l,r| str[l..-1] <=> str[r..-1]}.map!{|e| str[e-1]}*"" | |
end | |
def convert_i(str) | |
idxlist = (0...str.size).to_a.sort!{|l,r| str[l..-1] <=> str[r..-1]} | |
head = idxlist.index(0) |
This file contains hidden or 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
#pragma GCC optimize ("O3") | |
#pragma GCC target ("avx") | |
#include "bits/stdc++.h" // define macro "/D__MAI" | |
using namespace std; | |
typedef unsigned int uint; | |
typedef long long int ll; | |
typedef unsigned long long int ull; | |
#define debugv(v) printf("L%d %s => ",__LINE__,#v);for(auto e:v){cout<<e<<" ";}cout<<endl; |
This file contains hidden or 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
# https://codeiq.jp/q/2841 | |
# | |
# 方針:(n>=2) | |
# | |
# 各列のパターンは次の5つのいずれか. | |
# 0.___ 1.#__ 2._#_ 3.__# 4.#_# | |
# | |
# i列目にそのパターンが配置できるかどうか判定するには,i-1,i-2列目の情報が必要. | |
# 愚直に再帰を使って実装すると,gchokuメソッドのようになる.TLE. | |
# |
This file contains hidden or 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
/* | |
最小頂点被覆の近似解を求める. | |
初めに線形時間で終わる2倍近似アルゴリズムを走らせ,そのあと,焼きなましで改善する. | |
*/ | |
#include "bits/stdc++.h" | |
using namespace std; | |
#define TIME std::chrono::system_clock::now() |
This file contains hidden or 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; | |
struct Hoge{ | |
int a,b,c; | |
Hoge(int a=0,int b=0,int c=0):a(a),b(b),c(c){} | |
}; | |
int main(){ | |
vector<int> mat; |
This file contains hidden or 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; | |
template<size_t buffer_size = 1024> | |
class Brainfucker{ | |
public: | |
string code; | |
string input; | |
string output; |