Submission #71478355
Source Code Expand
/* Code By WCM */
/*
Date:
大致思路:
复杂度:
期望得分:
*/
#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <vector>
#include <queue>
#define all(x) x.begin(),x.end()
#define pii pair<int,int>
#define fi first
#define se second
#define pb push_back
#define int long long
using namespace std;
inline int read();
void write(int);
void writeln(int);
signed main() {
// freopen(".in", "r", stdin);
// freopen(".out", "w", stdout);
int n = read();
vector <int> a(n + 1);
for(int i = 1; i <= n; i++) a[i] = read();
int R = a[1];
for(int i = 1; i <= n && i <= R; i++) R = max(R, i + a[i] - 1);
printf("%lld\n", min(R, n));
// printf("\nThe time used: ");
// printf("%.2lfs",(double)clock()/CLOCKS_PER_SEC);
return 0;
}
inline int read() {
int res = 0, f = 1;
char ch = getchar();
while(ch < '0' || ch > '9') f = (ch == '-' ? -1 : 1), ch = getchar();
while(ch >= '0' && ch <= '9') res = (res << 1) + (res << 3) + (ch ^ 48), ch = getchar();
return res * f;
}
void write(int x) {
static int sta[35];
int top = 0;
do { sta[top++] = x % 10, x /= 10; } while(x);
while(top) putchar(sta[--top] ^ 48);
}
void writeln(int x) {
write(x);
putchar('\n');
}
Submission Info
| Submission Time | |
|---|---|
| Task | C - Domino |
| User | WZwangchongming |
| Language | C++23 (GCC 15.2.0) |
| Score | 300 |
| Code Size | 1328 Byte |
| Status | AC |
| Exec Time | 14 ms |
| Memory | 7540 KiB |
Judge Result
| Set Name | Sample | All | ||||
|---|---|---|---|---|---|---|
| Score / Max Score | 0 / 0 | 300 / 300 | ||||
| Status |
|
|
| Set Name | Test Cases |
|---|---|
| Sample | sample_01.txt, sample_02.txt, sample_03.txt |
| All | min.txt, random_01.txt, random_02.txt, random_03.txt, random_04.txt, random_05.txt, random_06.txt, random_07.txt, random_08.txt, random_09.txt, random_10.txt, random_11.txt, random_12.txt, random_13.txt, random_14.txt, random_15.txt, random_16.txt, sample_01.txt, sample_02.txt, sample_03.txt |
| Case Name | Status | Exec Time | Memory |
|---|---|---|---|
| min.txt | AC | 1 ms | 3792 KiB |
| random_01.txt | AC | 14 ms | 7364 KiB |
| random_02.txt | AC | 6 ms | 4940 KiB |
| random_03.txt | AC | 14 ms | 7540 KiB |
| random_04.txt | AC | 3 ms | 4096 KiB |
| random_05.txt | AC | 14 ms | 7288 KiB |
| random_06.txt | AC | 13 ms | 7288 KiB |
| random_07.txt | AC | 13 ms | 7416 KiB |
| random_08.txt | AC | 8 ms | 5624 KiB |
| random_09.txt | AC | 13 ms | 7476 KiB |
| random_10.txt | AC | 11 ms | 6576 KiB |
| random_11.txt | AC | 14 ms | 7336 KiB |
| random_12.txt | AC | 4 ms | 4600 KiB |
| random_13.txt | AC | 6 ms | 7372 KiB |
| random_14.txt | AC | 14 ms | 7400 KiB |
| random_15.txt | AC | 13 ms | 7288 KiB |
| random_16.txt | AC | 13 ms | 7352 KiB |
| sample_01.txt | AC | 1 ms | 3736 KiB |
| sample_02.txt | AC | 1 ms | 3740 KiB |
| sample_03.txt | AC | 1 ms | 3876 KiB |