Submission #1215084
Source Code Expand
def calcs(x,y,ax,ay,bx,by) ((ax-x)*(by-y)-(bx-x)*(ay-y))/2.0 end def inpf() a=gets.to_s.chomp.split(" ").map(&:to_f)end def inps() a=gets.to_s.chomp.split(" ")end def copy(a) Marshal.load(Marshal.dump(a)) end def kaizyo(n)(n < 2)? 1 : (2..n).inject(:*) end def scount(a) b=na(a.max+1);a.each{|n|b[n]+=1};return b end def na(n,d=0) Array.new(n,d)end def na2(n,m,d=0) Array.new(n){Array.new(m,d)}end def na3(n,m,l,d=0) Array.new(n){Array.new(m){Array.new(l,d)}}end def bit(n) n.to_s(2).split("").map(&:to_i) end def inp() a=gets.to_s.chomp.split(" ").map{|u|u.to_i}end n,k=inp a=inp ss=na(0,"") n.times do |i| ss.push(inps[0]) end ni = na(0,"") a.sort!.each do |d| ni.push(ss[d-1]) end a.reverse_each do |d| ss.delete_at(d-1) end max = "" min = "" ni.sort! ss.each do |s| if(s < ni[0]) if(min =="") min = s elsif(s > min) min = s end elsif(s > ni[-1]) if(max =="") max = s elsif(s < max) max = s end else puts -1 exit end end drf1="" drf2="" if(min != "") x=0 len=[min.size,ni[0].size].min while true if(x == len) drf1 += ni[0][x] break end drf1 += ni[0][x] break if(ni[0][x] != min[x]) x+=1 end end if(max != "") if(max != "") x=0 len=[max.size,ni[-1].size].min while true if(x == len) break end drf2 += ni[-1][x] break if(ni[-1][x] != max[x]) x+=1 end end end puts (drf1.size > drf2.size)? drf1 : drf2
Submission Info
Submission Time | |
---|---|
Task | C - 検索 |
User | zazaboon |
Language | Crystal (0.20.5) |
Score | 400 |
Code Size | 1548 Byte |
Status | AC |
Exec Time | 950 ms |
Memory | 12284 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 400 / 400 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | sample1.txt, sample2.txt, sample3.txt |
All | sample1.txt, sample2.txt, sample3.txt, in1.txt, in10.txt, in11.txt, in12.txt, in13.txt, in14.txt, in15.txt, in16.txt, in17.txt, in18.txt, in19.txt, in2.txt, in20.txt, in3.txt, in4.txt, in5.txt, in6.txt, in7.txt, in8.txt, in9.txt, long.txt, long2.txt, sample1.txt, sample2.txt, sample3.txt, long.txt, long2.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
in1.txt | AC | 4 ms | 892 KB |
in10.txt | AC | 4 ms | 892 KB |
in11.txt | AC | 11 ms | 1276 KB |
in12.txt | AC | 4 ms | 892 KB |
in13.txt | AC | 4 ms | 1020 KB |
in14.txt | AC | 4 ms | 892 KB |
in15.txt | AC | 4 ms | 892 KB |
in16.txt | AC | 2 ms | 2556 KB |
in17.txt | AC | 4 ms | 892 KB |
in18.txt | AC | 5 ms | 892 KB |
in19.txt | AC | 10 ms | 1276 KB |
in2.txt | AC | 11 ms | 1404 KB |
in20.txt | AC | 4 ms | 1020 KB |
in3.txt | AC | 193 ms | 6524 KB |
in4.txt | AC | 151 ms | 12284 KB |
in5.txt | AC | 4 ms | 892 KB |
in6.txt | AC | 2 ms | 764 KB |
in7.txt | AC | 4 ms | 892 KB |
in8.txt | AC | 10 ms | 1148 KB |
in9.txt | AC | 160 ms | 11644 KB |
long.txt | AC | 721 ms | 1404 KB |
long2.txt | AC | 950 ms | 3452 KB |
sample1.txt | AC | 2 ms | 636 KB |
sample2.txt | AC | 2 ms | 636 KB |
sample3.txt | AC | 2 ms | 636 KB |