Submission #440739

# Submission time Handle Problem Language Result Execution time Memory
440739 2021-07-02T20:45:19 Z MrDeboo Exam (eJOI20_exam) C++17
0 / 100
17 ms 416 KB
#include <bits/stdc++.h>
#define int long long
#define mod 1000000007
#define endl '\n'
using namespace std;
signed main(){
    ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
    int n;
    cin>>n;
    pair<int,int>pr[n];
    for(int i=0;i<n;i++){
        cin>>pr[i].first;
    }
    for(int i=0;i<n;i++){
        cin>>pr[i].second;
    }
    int arr[n];
    for(int i=0;i<n;i++)arr[i]=0;
    for(int i=0;i<n;i++){
        if(i>0)arr[i]=arr[i-1];
        int temp=0;
        for(int w=i-1;w>=0;w--){
            if(pr[w].second==pr[i].first)temp++;
            if(temp+(w>0?arr[w-1]:0)>arr[i-1])arr[i]=temp+(w>0?arr[w-1]:0);
            else arr[i]=arr[i-1];
        }
        if(pr[i].first==pr[i].second)arr[i]++;
    }
    cout<<arr[n-1];
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 5 ms 204 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 17 ms 416 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 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 204 KB Output is correct
2 Correct 0 ms 204 KB Output is correct
3 Correct 0 ms 204 KB Output is correct
4 Correct 0 ms 204 KB Output is correct
5 Incorrect 0 ms 204 KB Output isn't correct
6 Halted 0 ms 0 KB -