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<cstdio> | |
#include<iostream> | |
using namespace std; | |
bool dfs(int, int); | |
void solve(int); | |
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<cstdio> | |
#include<iostream> | |
using namespace std; | |
void dfs(int, int); | |
int n, m; |
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
$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| |
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
$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| |
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
$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| |
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
#!/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)} |
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
#!/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 |
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
#!/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 |
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
#!/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 |
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
#!/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 |
OlderNewer