結果
| 問題 |
No.2894 Monotonic Intervals
|
| コンテスト | |
| ユーザー |
|
| 提出日時 | 2024-09-20 21:58:36 |
| 言語 | Rust (1.83.0 + proconio) |
| 結果 |
AC
|
| 実行時間 | 6 ms / 2,000 ms |
| コード長 | 443 bytes |
| コンパイル時間 | 24,829 ms |
| コンパイル使用メモリ | 400,836 KB |
| 実行使用メモリ | 5,376 KB |
| 最終ジャッジ日時 | 2024-09-20 21:59:05 |
| 合計ジャッジ時間 | 14,175 ms |
|
ジャッジサーバーID (参考情報) |
judge2 / judge4 |
(要ログイン)
| ファイルパターン | 結果 |
|---|---|
| sample | AC * 3 |
| other | AC * 14 |
ソースコード
use proconio::{input, marker::Chars};
fn main() {
input! {
_n: usize,
s: Chars,
}
let mut negative = 0_usize;
let mut positive = 0_usize;
for &c in &s {
if c == '<' {
(negative, positive) = (negative, positive.max(negative + 1));
} else {
(negative, positive) = (negative.max(positive + 1), positive);
}
}
println!("{}", negative.max(positive));
}