Submission #2516446
Source Code Expand
var n,m,i,j,liu,buliu,k:longint; ans,max:int64; f,w,t:array[0..100005] of longint; function maxx(a,b:longint):longint; begin if a>b then exit(a) else exit(b); end; function minn(a,b:longint):longint; begin if a<b then exit(a) else exit(b); end; begin readln(n,m); for i:=1 to n do read(f[i]); readln; for i:=1 to m do read(w[i]); for i:=1 to n do begin for j:=i to n do begin ans:=0; for k:=i to j do if t[f[k]]=0 then begin inc(ans,w[f[k]]); liu:=maxx(liu,f[k]); buliu:=minn(buliu,f[k]); inc(t[f[k]]); end else if t[f[k]]=1 then begin dec(ans,w[f[k]]); t[f[k]]:=2; end; for k:=buliu to liu do t[k]:=0; max:=maxx(max,ans); end; end; write(max); end.
Submission Info
Submission Time | |
---|---|
Task | O - 数列色ぬり |
User | vjudge2 |
Language | Bash (GNU bash v4.3.11) |
Score | 0 |
Code Size | 925 Byte |
Status | RE |
Exec Time | 3 ms |
Memory | 556 KB |
Judge Result
Set Name | Sample | All | ||||
---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 250 | ||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | example_0.txt, example_1.txt, example_2.txt, example_3.txt |
All | alluse_0.txt, alluse_1.txt, alluse_2.txt, corner_0.txt, cross_0.txt, cross_1.txt, cross_2.txt, cross_3.txt, cross_4.txt, example_0.txt, example_1.txt, example_2.txt, example_3.txt, handmade_0.txt, handmade_1.txt, handmade_2.txt, handmade_3.txt, kaidan_0.txt, kaidan_1.txt, kaidan_2.txt, kaidan_tatenaga_0.txt, kaidan_tatenaga_1.txt, kaidan_tatenaga_2.txt, kaidan_yokonaga_0.txt, kaidan_yokonaga_1.txt, kaidan_yokonaga_2.txt, maxrand_0.txt, maxrand_1.txt, maxrand_2.txt, maxrand_3.txt, maxrand_4.txt, random_0.txt, random_1.txt, random_2.txt, random_3.txt, random_4.txt, rectcross_0.txt, rectcross_1.txt, rectcross_2.txt, rectcross_3.txt, rectcross_4.txt, rectcross_5.txt, smallrand_0.txt, smallrand_1.txt, smallrand_2.txt, square_0.txt, square_1.txt, square_2.txt, square_r_0.txt, square_r_1.txt, square_r_2.txt, tatenaga_0.txt, tatenaga_1.txt, tatenaga_2.txt, yokonaga_0.txt, yokonaga_1.txt, yokonaga_2.txt, example_0.txt, example_1.txt, example_2.txt, example_3.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
alluse_0.txt | RE | 3 ms | 548 KB |
alluse_1.txt | RE | 3 ms | 548 KB |
alluse_2.txt | RE | 3 ms | 548 KB |
corner_0.txt | RE | 3 ms | 548 KB |
cross_0.txt | RE | 3 ms | 548 KB |
cross_1.txt | RE | 3 ms | 548 KB |
cross_2.txt | RE | 3 ms | 548 KB |
cross_3.txt | RE | 3 ms | 548 KB |
cross_4.txt | RE | 3 ms | 548 KB |
example_0.txt | RE | 3 ms | 556 KB |
example_1.txt | RE | 3 ms | 548 KB |
example_2.txt | RE | 3 ms | 556 KB |
example_3.txt | RE | 3 ms | 548 KB |
handmade_0.txt | RE | 3 ms | 556 KB |
handmade_1.txt | RE | 3 ms | 548 KB |
handmade_2.txt | RE | 3 ms | 556 KB |
handmade_3.txt | RE | 3 ms | 548 KB |
kaidan_0.txt | RE | 3 ms | 556 KB |
kaidan_1.txt | RE | 3 ms | 548 KB |
kaidan_2.txt | RE | 3 ms | 548 KB |
kaidan_tatenaga_0.txt | RE | 3 ms | 548 KB |
kaidan_tatenaga_1.txt | RE | 3 ms | 548 KB |
kaidan_tatenaga_2.txt | RE | 3 ms | 552 KB |
kaidan_yokonaga_0.txt | RE | 3 ms | 548 KB |
kaidan_yokonaga_1.txt | RE | 3 ms | 548 KB |
kaidan_yokonaga_2.txt | RE | 3 ms | 548 KB |
maxrand_0.txt | RE | 3 ms | 556 KB |
maxrand_1.txt | RE | 3 ms | 548 KB |
maxrand_2.txt | RE | 3 ms | 556 KB |
maxrand_3.txt | RE | 3 ms | 548 KB |
maxrand_4.txt | RE | 3 ms | 548 KB |
random_0.txt | RE | 3 ms | 548 KB |
random_1.txt | RE | 3 ms | 548 KB |
random_2.txt | RE | 3 ms | 556 KB |
random_3.txt | RE | 3 ms | 548 KB |
random_4.txt | RE | 3 ms | 556 KB |
rectcross_0.txt | RE | 3 ms | 548 KB |
rectcross_1.txt | RE | 3 ms | 548 KB |
rectcross_2.txt | RE | 3 ms | 548 KB |
rectcross_3.txt | RE | 3 ms | 548 KB |
rectcross_4.txt | RE | 3 ms | 548 KB |
rectcross_5.txt | RE | 3 ms | 548 KB |
smallrand_0.txt | RE | 3 ms | 548 KB |
smallrand_1.txt | RE | 3 ms | 548 KB |
smallrand_2.txt | RE | 3 ms | 548 KB |
square_0.txt | RE | 3 ms | 556 KB |
square_1.txt | RE | 3 ms | 552 KB |
square_2.txt | RE | 3 ms | 548 KB |
square_r_0.txt | RE | 3 ms | 548 KB |
square_r_1.txt | RE | 3 ms | 548 KB |
square_r_2.txt | RE | 3 ms | 548 KB |
tatenaga_0.txt | RE | 3 ms | 548 KB |
tatenaga_1.txt | RE | 3 ms | 548 KB |
tatenaga_2.txt | RE | 3 ms | 556 KB |
yokonaga_0.txt | RE | 3 ms | 556 KB |
yokonaga_1.txt | RE | 3 ms | 548 KB |
yokonaga_2.txt | RE | 3 ms | 548 KB |