Run ID | 作者 | 问题 | 语言 | 测评结果 | 分数 | 时间 | 内存 | 代码长度 | 提交时间 |
---|---|---|---|---|---|---|---|---|---|
28338 | 22级赵奕绚 | 【J】T2 | C++ | 通过 | 100 | 16 MS | 460 KB | 327 | 2024-04-14 14:20:33 |
#include<bits/stdc++.h> using namespace std; int n,a[100010],f; int main(){ cin >> n; int l=1,cnt=0,b=1; for(int i=1;i<=n;i++){ cin >> f; if(i>l) a[cnt++]=b; if(i+f>l){ l=i+f;b=i; } } if(l!=n+1) a[cnt++]=b; cout << cnt << endl; for(int i=0;i<cnt;i++){ cout << a[i] << " "; } return 0; }