Submission #576701

# Submission time Handle Problem Language Result Execution time Memory
576701 2022-06-13T09:34:23 Z ammar124 Exam (eJOI20_exam) C++14
0 / 100
2 ms 340 KB
#include <bits/stdc++.h>
#define endl '\n'
#define ll long long
using namespace std;
int const maxin = 1e5+6;

int main()
{
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int a;
    ll ans = 0;
    cin>>a;
    int arr[a];
    int arr2[a];
    for(int i=0;i<a;i++)
        cin>>arr[i];
    for(int i=0;i<a;i++)
        cin>>arr2[i];
    ll x = arr2[0];
    bool flag = true ;
    for(int i=0;i<a;i++)
    {
        if(arr[i] == x)
        {
            ans++;
            if(flag == true)
            {
                flag = false ;
                for(int j=i-1;j>=0;j--)
                {
                    if(arr[j] <= x)
                        ans++;
                    else
                        break;
                }
            }
            for(int j=i+1;j<a;j++)
            {
                if(arr[j] <= x)
                    ans++;
                else
                {
                    i = j+1;
                    break;
                }
            }
        }
    }
    cout<<ans;
    return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 320 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 340 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 320 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -