Submission #15433814


Source Code Expand

Copy
use proconio::input;

fn main() {
    input! {
        n: usize,
        a: [i64; n],
    };
    let mut s = 0;
    let mut m = 1_000_i64;
    for i in 0..n {
        if i == n - 1 {
            m += a[i] * s;
        }
        for j in i + 1..n {
            if a[i] == a[j] {
                continue;
            } else if a[i] < a[j] {
                if s == 0 {
                    s = m / a[i];
                    m -= a[i] * s;
                }
                break;
            } else if a[i] > a[j] {
                m += a[i] * s;
                s = 0;
                break;
            }
        }
    }
    let ans = m;
    println!("{}", ans);
}

Submission Info

Submission Time
Task D - Road to Millionaire
User bouzuya
Language Rust (1.42.0)
Score 400
Code Size 665 Byte
Status
Exec Time 7 ms
Memory 2164 KB

Judge Result

Set Name Score / Max Score Test Cases
Sample 0 / 0
All 400 / 400 00-sample-01.txt, 00-sample-02.txt, 00-sample-03.txt, 01-random-01.txt, 01-random-02.txt, 01-random-03.txt, 01-random-04.txt, 01-random-05.txt, 01-random-06.txt, 01-random-07.txt, 01-random-08.txt, 01-random-09.txt, 01-random-10.txt, 02-increasing-01.txt, 03-decreasing-01.txt, 04-large-01.txt, 04-large-02.txt, 04-large-03.txt, 05-maximum-01.txt, 05-maximum-02.txt, 05-maximum-03.txt
Case Name Status Exec Time Memory
00-sample-01.txt 7 ms 2108 KB
00-sample-02.txt 2 ms 2136 KB
00-sample-03.txt 2 ms 1972 KB
01-random-01.txt 2 ms 2040 KB
01-random-02.txt 2 ms 2088 KB
01-random-03.txt 1 ms 2036 KB
01-random-04.txt 2 ms 2160 KB
01-random-05.txt 2 ms 2116 KB
01-random-06.txt 2 ms 2144 KB
01-random-07.txt 2 ms 2108 KB
01-random-08.txt 3 ms 2152 KB
01-random-09.txt 2 ms 2104 KB
01-random-10.txt 2 ms 2056 KB
02-increasing-01.txt 3 ms 2132 KB
03-decreasing-01.txt 2 ms 2148 KB
04-large-01.txt 2 ms 2096 KB
04-large-02.txt 2 ms 2060 KB
04-large-03.txt 2 ms 2036 KB
05-maximum-01.txt 2 ms 1980 KB
05-maximum-02.txt 1 ms 2028 KB
05-maximum-03.txt 2 ms 2164 KB