Submission #440740

# Submission time Handle Problem Language Result Execution time Memory
440740 2021-07-02T20:47:54 Z MrDeboo Exam (eJOI20_exam) C++17
0 / 100
31 ms 404 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);
        }
        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 2 ms 332 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 204 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 31 ms 404 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 -