結果
問題 | No.2894 Monotonic Intervals |
ユーザー |
|
提出日時 | 2024-09-20 22:23:43 |
言語 | C++23 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 14 ms / 2,000 ms |
コード長 | 487 bytes |
コンパイル時間 | 2,980 ms |
コンパイル使用メモリ | 80,320 KB |
実行使用メモリ | 6,944 KB |
最終ジャッジ日時 | 2024-09-20 22:23:55 |
合計ジャッジ時間 | 3,939 ms |
ジャッジサーバーID (参考情報) |
judge4 / judge3 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 14 |
ソースコード
#include <iostream> #include <string> using namespace std; int main () { int N; cin >> N; string S; cin >> S; int ans = 0; int state = 0; for (auto c : S) { if (c == '>') { if (0 <= state) { state = -1; ans++; } } if (c == '<') { if (state <= 0) { state = 1; ans++; } } } cout << ans << "\n"; return 0; }