Submission #469672

# Submission time Handle Problem Language Result Execution time Memory
469672 2021-09-01T14:46:29 Z Itamar Exam (eJOI20_exam) C++14
12 / 100
115 ms 3344 KB
#include <vector>
#include <algorithm>
using namespace std;
#include <iostream>

vector<int> pre;
int n;
/*int lower_bo(int l, int r, int val) {
    int mid = (l + r) / 2;
    if (pre[mid] < val && (mid == n || pre[mid+1] >= val) ) {
        return mid+1;
    }
    if (pre[mid] < val) {
        return lower_bo(mid + 1, r, val);
    }
    if (pre[mid] > val) {
        return lower_bo(l, mid - 1, val);
    }
}*/
int main()
{
    int n;
    cin >> n;
    vector<int> r;
    vector<int> m;

    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        m.push_back(x);
    }
    for (int i = 0; i < n; i++) {
        int x;
        cin >> x;
        //for (int j = i; j < n; j++) {

            //if (x == m[j]) {
                r.push_back(x);
            //    break;
            //}
        //}
    }
    int cur = -1;
    bool is = false;
    int sum = 0;
    for (int i = 0; i < n; i++) {
        if (m[i] == r[0]) {
            is = true;
        }
        if (i == n - 1) {
            if (is) {
                sum += i - cur - 1;
                if (m[i] <= r[0]) {
                    sum++;
                }
            }
            
        }
        else {
            if (m[i] > r[0]) {
                if (is) {
                    sum += i - cur - 1;
                }
                cur = i;
                is = 0;
            }
        }
    }
    cout << sum;
    /*int siz = r.size();
    vector<int>max(siz, -1);
    for (int i = 0; i < siz; i++) {
        
        for (int j = 0; j < siz; j++) {

            if (max[j] <= r[i] && max[j] != -1) {
                if (max[j + 1] > r[i] || max[j + 1] == -1) {
                    max[j + 1] = r[i];
                    break;
                }
                
            }
        }
        if (max[0] > r[i] || max[0] == -1) {
            max[0] = r[i];
        }

        
    }
    for (int i = siz-1; i >= 0; i--) {
        if (max[i] != -1) {
            cout << i+1;
            break;
        }
    }
    if (siz == 0) {
        cout << 0;
    }*/
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 19 ms 460 KB Output is correct
3 Correct 59 ms 1340 KB Output is correct
4 Correct 38 ms 1348 KB Output is correct
5 Correct 102 ms 3344 KB Output is correct
6 Correct 41 ms 1760 KB Output is correct
7 Correct 43 ms 1920 KB Output is correct
8 Correct 115 ms 3200 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Incorrect 0 ms 204 KB Output isn't correct
3 Halted 0 ms 0 KB -