Submission #832769

# Submission time Handle Problem Language Result Execution time Memory
832769 2023-08-21T14:39:38 Z GordonRemzi007 Exam (eJOI20_exam) C++17
0 / 100
3 ms 436 KB
#include <bits/stdc++.h>
using namespace std;

int main() {
    int n, l = -1, r, mid, res = 0;
    bool can = false;
    cin >> n;
    vector<int> a(n), b(n);
    for(int i = 0; i < n; i++) cin >> a[i];
    for(int i = 0; i < n; i++) cin >> b[i];
    for(int i = 0; i < n; i++) {
        if(a[i] > b[0]) {
            if(can) res+=i-l-1;
            l = i;
        } else if(a[i] == b[0]) can = true;
    }
    cout << res+n-l-1 << "\n";
    //dp
    /*vector<int> dp(n+1, INT_MIN);
    dp[0] = INT_MAX;
    for(int i = 0; i < n; i++) {
        
    }*/
}

Compilation message

exam.cpp: In function 'int main()':
exam.cpp:5:20: warning: unused variable 'r' [-Wunused-variable]
    5 |     int n, l = -1, r, mid, res = 0;
      |                    ^
exam.cpp:5:23: warning: unused variable 'mid' [-Wunused-variable]
    5 |     int n, l = -1, r, mid, res = 0;
      |                       ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 436 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 Incorrect 0 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Incorrect 0 ms 300 KB Output isn't correct
3 Halted 0 ms 0 KB -