This submission is migrated from previous version of oj.uz, which used different machine for grading. This submission may have different result if resubmitted.
#include <iostream>
#include <algorithm>
#include <vector>
#include <queue>
#include <set>
#include <string>
#include <cmath>
#include <map>
#include <unordered_map>
#include <fstream>
#include <iomanip>
#include <iterator>
#include <stack>
using namespace std;
using ll = long long;
const int maxn = 100005;
int a[maxn];
int b[maxn];
bool stug[maxn];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(0);
int n, i, j;
cin >> n;
for ( i = 0; i < n; i++)
{
cin >> a[i];
}
for (i = 0; i < n; i++)
{
cin >> b[i];
}
if(1)
{
for ( i = 0; i < n; i++)
{
if (a[i] == b[0])
{
j = i - 1;
while (j >= 0 && a[j] != b[0] && a[j] <= b[0])
{
a[j] = b[0];
j--;
}
j = i + 1;
while (j < n && a[j] != b[0] && a[j] <= b[0])
{
a[j] = b[0];
j++;
}
}
}
int ans = 0;
for ( i = 0; i < n; i++)
{
if (a[i] == b[0])
ans++;
}
cout << ans;
}
return 0;
}
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |
| # | Verdict | Execution time | Memory | Grader output |
|---|
| Fetching results... |