Submission #675675

# Submission time Handle Problem Language Result Execution time Memory
675675 2022-12-27T17:47:31 Z a_aguilo Exam (eJOI20_exam) C++14
12 / 100
76 ms 1100 KB
#include<bits/stdc++.h>

using namespace std;

int main(){
    int n;
    cin >> n;
    int A[n];
    int B[n];
    for(int i = 0; i < n; ++i) cin >> A[i];
    for(int i = 0; i < n; ++i) cin >> B[i];
    queue<int> Q;
    int counter = 0;
    for(int i = 0; i < n; ++i){
        if(A[i] == B[i]) Q.push(i);
    }
    while(!Q.empty()){
        int actPos = Q.front();
        Q.pop();
        if(A[actPos] == B[actPos]) counter++;
        else continue;
        if(actPos > 0){
            if(A[actPos-1] != B[actPos] and A[actPos-1]<A[actPos]){
                A[actPos-1] = B[actPos];
                Q.push(actPos-1);
            }
        }
        if(actPos < (n-1)){
            if(A[actPos+1] != B[actPos] and A[actPos+1]<A[actPos]){
                A[actPos+1] = B[actPos];
                Q.push(actPos+1);
            }
        }
    }
    cout << counter<< endl;
    return 0;
}
# 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 Correct 1 ms 212 KB Output is correct
2 Correct 15 ms 452 KB Output is correct
3 Correct 42 ms 980 KB Output is correct
4 Correct 24 ms 1068 KB Output is correct
5 Correct 76 ms 980 KB Output is correct
6 Correct 25 ms 1100 KB Output is correct
7 Correct 31 ms 1064 KB Output is correct
8 Correct 71 ms 980 KB Output is correct
# 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 4 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 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -