#include <iostream>
#include <vector>
#include <string>
#include <set>
#include <cmath>
#include <tuple>
#include <queue>
#include <functional>
using namespace std;
/*long long int power(long long int n, int k)
{
long long int vys = 1;
for (int i = 0; i < k; i++)
{
vys = (vys * (n - i)) / (i + 1);
}
return vys;
}*/
int main()
{
/*for (int i = 0; i < 10; i++)
{
std::cout << "Hello Flash!\n";
}*/
//cout << "TU" << endl;
int n;
cin >> n;
vector<int>v(n);
vector<int>p(n);
for (int i = 0; i < n; i++)
{
cin >> v[i];
}
for (int i = 0; i < n; i++)
{
cin >> p[i];
}
int vys = 0;
vector<int>cheat(n, 0);//zaznacime si pre i-teho studenta ci podvadza alebo nie
for (int i = 0; i < n; i++)
{
if (v[i] == p[0])
{
int j = i;
int k = i-1;
for ( ;j < n; j++)
{
if (v[j] > v[i]||cheat[j]==1)
{
break;
}
cheat[j] = 1;
}
if (i > 0)
{
for (; k >= 0; k--)
{
if (v[k] > v[i]||cheat[k]==1)
{
break;
}
cheat[k] = 1;
}
}
// cout << j << ' ' << k << endl;
}
}
for (int i = 0; i < n; i++)
{
if (cheat[i] == 1)
{
vys += 1;
}
}
cout << vys << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Correct |
18 ms |
816 KB |
Output is correct |
3 |
Correct |
56 ms |
2264 KB |
Output is correct |
4 |
Correct |
37 ms |
1832 KB |
Output is correct |
5 |
Correct |
92 ms |
3488 KB |
Output is correct |
6 |
Correct |
39 ms |
1860 KB |
Output is correct |
7 |
Correct |
49 ms |
2000 KB |
Output is correct |
8 |
Correct |
91 ms |
3352 KB |
Output is correct |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
0 ms |
204 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
5 ms |
332 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
1 ms |
204 KB |
Output is correct |
2 |
Incorrect |
1 ms |
204 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |