Submission #759730

# Submission time Handle Problem Language Result Execution time Memory
759730 2023-06-16T16:29:47 Z ihceker Exam (eJOI20_exam) C++14
0 / 100
9 ms 604 KB
#include<bits/stdc++.h>
#define int long long
#define MOD 1000000007
#define all(x) x.begin(),x.end()
#define ff first
#define ss second
#define pb push_back
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);

using namespace std;

int32_t main(){
	int n;
	cin>>n;
	int a[n],b[n];
	set<int>s;
	for(int i=0;i<n;i++){
		cin>>a[i];
		s.insert(a[i]);
	}
	for(int i=0;i<n;i++)cin>>b[i];
	int ans=0;
	vector<pair<int,int>>v;
	for(int i=0;i<n;i++){
		if(a[i]>b[i] || !s.count(b[i]))continue;
		v.pb({b[i],i});
	}
	sort(all(v));
	int dp[v.size()];
	for(int i=0;i<v.size();i++){
		int mx=0;
		for(int j=0;j<i;j++){
			mx=max(mx,dp[j]);
		}
		dp[i]=mx+1;
	}
	cout<<dp[v.size()-1]<<endl;
}

Compilation message

exam.cpp: In function 'int32_t main()':
exam.cpp:30:15: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<std::pair<long long int, long long int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   30 |  for(int i=0;i<v.size();i++){
      |              ~^~~~~~~~~
exam.cpp:22:6: warning: unused variable 'ans' [-Wunused-variable]
   22 |  int ans=0;
      |      ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 296 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 1 ms 340 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 9 ms 604 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 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 296 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 0 ms 212 KB Output is correct
3 Correct 1 ms 212 KB Output is correct
4 Correct 1 ms 212 KB Output is correct
5 Incorrect 1 ms 296 KB Output isn't correct
6 Halted 0 ms 0 KB -