結果
問題 | No.1868 Teleporting Cyanmond |
ユーザー |
![]() |
提出日時 | 2022-03-11 21:26:23 |
言語 | C++14 (gcc 13.3.0 + boost 1.87.0) |
結果 |
AC
|
実行時間 | 30 ms / 2,000 ms |
コード長 | 423 bytes |
コンパイル時間 | 595 ms |
コンパイル使用メモリ | 65,664 KB |
実行使用メモリ | 5,376 KB |
最終ジャッジ日時 | 2024-09-16 01:26:37 |
合計ジャッジ時間 | 2,062 ms |
ジャッジサーバーID (参考情報) |
judge2 / judge5 |
(要ログイン)
ファイルパターン | 結果 |
---|---|
sample | AC * 3 |
other | AC * 25 |
ソースコード
#include <algorithm> #include <iostream> using namespace std; typedef pair<int, int> P; int main() { int n; cin >> n; int r[100005]; for(int i = 0; i < n; i++) cin >> r[i]; int last = r[0]; int rmax = r[0]; int ans = 1; for(int i = 1; i < n; i++){ if(last <= i){ last = rmax; ans++; } rmax = max(rmax, r[i]); } cout << ans << endl; }