Submission #441501

# Submission time Handle Problem Language Result Execution time Memory
441501 2021-07-05T09:34:00 Z elazarkoren Exam (eJOI20_exam) C++17
0 / 100
7 ms 588 KB
#include <iostream>
#include <vector>
#include <algorithm>
#include <stack>
#include <set>
#define x first
#define y second
//#define int long long
using namespace std;
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int, int> pii;
typedef vector<pii> vii;

const int MAX_N = 1e5 + 1;

int a[MAX_N], b[MAX_N];

int main() {
    int n;
    cin >> n;
    set<int> visited;
    for (int i = 0; i < n; i++) {
        cin >> a[i];
        visited.insert(a[i]);
    }
    int ans = 0;
    for (int i = 0; i < n; i++) {
        cin >> b[i];
        if (visited.find(b[i]) != visited.end() && b[i] >= a[i])  ans++;
    }
//    int ans = a[0] == b[0];
//    for (int i = 1; i < n; i++) {
//        int count = a[i] == b[i];
//        int best_count = a[i] == b[i], ind = i;
//        for (int j = i - 1; j >= 0; j--) {
//            if (a[j] == b[j]) count--;
//            if (a[i] == b[j]) count++;
//            if (count > best_count) {
//                best_count = count;
//                ind = j;
//            }
//        }
//        for (int j = i - 1; j >= ind; j--) a[j] = a[i];
//        ans += best_count;
//    }
    cout << ans;
}
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 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 7 ms 588 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 0 ms 304 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 1 ms 312 KB Output is correct
5 Incorrect 1 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -