Skip to content

Instantly share code, notes, and snippets.

Avatar
🦦
EST

Yuka Ikarashi yamaguchi1024

🦦
EST
View GitHub Profile
View gist:cbfd381f0195ac4ec5b2
#include<cstdio>
#include<iostream>
using namespace std;
void dfs(int, int);
int n, m;
View gist:50b7f5f5183dcc2d6edf
#include<cstdio>
#include<iostream>
using namespace std;
bool dfs(int, int);
void solve(int);
View ai.rb
$n = gets.chomp.to_i
$money = gets.chomp.to_i
$board = Array.new($n)
$n.times.with_index {|i|
$board[i] = gets.chomp.split('')
}
#warn $board
$bases=Array.new
$n.times do |i|
View ai.rb
$n = gets.chomp.to_i
$money = gets.chomp.to_i
$board = Array.new($n)
$n.times.with_index {|i|
$board[i] = gets.chomp.split('')
}
#warn $board
$bases=Array.new
$n.times do |i|
View ai.rb
$n = gets.chomp.to_i
$money = gets.chomp.to_i
$board = Array.new($n)
$n.times.with_index {|i|
$board[i] = gets.chomp.split('')
}
#warn $board
$bases=Array.new
$n.times do |i|
View array.rb
#!/usr/bin/ruby
class Matrix
MEMSIZE=[16, 32, 64, 128, 256, 512, 1024]
def run
print "N,seconds,Mop/s\n"
MEMSIZE.each { |n|
a=Array.new(n){Array.new(n)}
b=Array.new(n){Array.new(n)}
c=Array.new(n){Array.new(n)}
View 3_buble.rb
#!/usr/bin/ruby
require 'openssl'
class Array
def quick_sort
if ($n==500 && $log<700) || ($n==2000 && $log<3000) || ($n==4000 && $log<6000) || ($n==6000 && $log<8500) || ($n==8000 && $log<11000) || ($n==10000 && $log<14000)
$log+=1
return self if length <= 1
base = pop
smaller, bigger = partition { |e| e < base }
push base
View 3_merge.rb
#!/usr/bin/ruby
require 'openssl'
class Array
def quick_sort
if ($n==500 && $log<700) || ($n==2000 && $log<3000) || ($n==4000 && $log<6000) || ($n==6000 && $log<8500) || ($n==8000 && $log<11000) || ($n==10000 && $log<14000)
$log+=1
return self if length <= 1
base = pop
smaller, bigger = partition { |e| e < base }
push base
View 3_quick.rb
#!/usr/bin/ruby
require 'openssl'
class Array
def quick_sort
return self if length <= 1
base = pop
smaller, bigger = partition { |e| e < base }
push base
smaller.quick_sort + [base] + bigger.quick_sort
end
View 4_1_buble.rb
#!/usr/bin/ruby
require 'openssl'
class N2Sort
def initialize(n)
$a=Array.new(n)
end
def fill_reverse(n)
initialize(n)
n.times do |i|
$a[i]=n-1