#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC optimize("Ofast")
#pragma GCC optimize("unroll-loops")
#define int long long
using namespace std;
int dp[1004];
signed main(){
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, m, q;
cin >> n >> m >> q;
vector<int> a(n);
int ans = 0;
for(int i = 0; i < n; ++i){
cin >> a[i];
}
for(int rep = 1; rep <= 2; ++rep){
int chk = 0;
for(int i = 0; i < n; ++i){
if(a[i] >= rep){
if(i && !chk) ++ans;
chk = 1;
int j = i;
while(j + 1 < n && a[j + 1] >= rep){
++j;
++ans;
}
i = j;
if(i + 1 < n){
++ans;
}
}
}
}
cout << ans << '\n';
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
8 ms |
1876 KB |
Output is correct |
3 |
Correct |
8 ms |
1876 KB |
Output is correct |
4 |
Correct |
9 ms |
1876 KB |
Output is correct |
5 |
Correct |
15 ms |
1876 KB |
Output is correct |
6 |
Correct |
15 ms |
1876 KB |
Output is correct |
7 |
Correct |
9 ms |
1876 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
8 ms |
1876 KB |
Output is correct |
3 |
Correct |
8 ms |
1876 KB |
Output is correct |
4 |
Correct |
9 ms |
1876 KB |
Output is correct |
5 |
Correct |
15 ms |
1876 KB |
Output is correct |
6 |
Correct |
15 ms |
1876 KB |
Output is correct |
7 |
Correct |
9 ms |
1876 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
8 ms |
1876 KB |
Output is correct |
3 |
Correct |
8 ms |
1876 KB |
Output is correct |
4 |
Correct |
9 ms |
1876 KB |
Output is correct |
5 |
Correct |
15 ms |
1876 KB |
Output is correct |
6 |
Correct |
15 ms |
1876 KB |
Output is correct |
7 |
Correct |
9 ms |
1876 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
8 ms |
1876 KB |
Output is correct |
3 |
Correct |
8 ms |
1876 KB |
Output is correct |
4 |
Correct |
9 ms |
1876 KB |
Output is correct |
5 |
Correct |
15 ms |
1876 KB |
Output is correct |
6 |
Correct |
15 ms |
1876 KB |
Output is correct |
7 |
Correct |
9 ms |
1876 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
212 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
212 KB |
Output is correct |
2 |
Correct |
8 ms |
1876 KB |
Output is correct |
3 |
Correct |
8 ms |
1876 KB |
Output is correct |
4 |
Correct |
9 ms |
1876 KB |
Output is correct |
5 |
Correct |
15 ms |
1876 KB |
Output is correct |
6 |
Correct |
15 ms |
1876 KB |
Output is correct |
7 |
Correct |
9 ms |
1876 KB |
Output is correct |
8 |
Correct |
0 ms |
212 KB |
Output is correct |
9 |
Incorrect |
0 ms |
212 KB |
Output isn't correct |
10 |
Halted |
0 ms |
0 KB |
- |