Submission #7389865


Source Code Expand

Copy
<?php
fscanf(STDIN, '%d', $n);
$b = array_map('intval', explode(' ', trim(fgets(STDIN))));
$ans = 0;
for ($i = 0; $i < $n; $i++) {
    $ans += min($b[$i - 1] ?? $b[$i], $b[$i] ?? $b[$i - 1]);
}
echo $ans . PHP_EOL;

Submission Info

Submission Time
Task C - Maximal Value
User hideyuk1
Language PHP7 (7.0.15)
Score 300
Code Size 221 Byte
Status AC
Exec Time 13 ms
Memory 4728 KB

Judge Result

Set Name Sample All
Score / Max Score 0 / 0 300 / 300
Status
AC × 3
AC × 15
Set Name Test Cases
Sample sample00, sample01, sample02
All handmade03, handmade04, handmade05, handmade06, handmade07, handmade08, handmade09, random10, random11, random12, random13, random14, sample00, sample01, sample02
Case Name Status Exec Time Memory
handmade03 AC 13 ms 4728 KB
handmade04 AC 9 ms 4604 KB
handmade05 AC 9 ms 4604 KB
handmade06 AC 9 ms 4604 KB
handmade07 AC 9 ms 4604 KB
handmade08 AC 9 ms 4604 KB
handmade09 AC 9 ms 4604 KB
random10 AC 9 ms 4604 KB
random11 AC 9 ms 4604 KB
random12 AC 9 ms 4604 KB
random13 AC 9 ms 4604 KB
random14 AC 9 ms 4604 KB
sample00 AC 9 ms 4604 KB
sample01 AC 9 ms 4604 KB
sample02 AC 9 ms 4604 KB