Submission #759729

# Submission time Handle Problem Language Result Execution time Memory
759729 2023-06-16T16:28:07 Z ihceker Exam (eJOI20_exam) C++14
0 / 100
7 ms 596 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];
	for(int i=0;i<n;i++)cin>>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])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:26: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]
   26 |  for(int i=0;i<v.size();i++){
      |              ~^~~~~~~~~
exam.cpp:18:6: warning: unused variable 'ans' [-Wunused-variable]
   18 |  int ans=0;
      |      ^~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 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 1 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 7 ms 596 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 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 212 KB Output is correct
2 Correct 1 ms 212 KB Output is correct
3 Incorrect 1 ms 212 KB Output isn't correct
4 Halted 0 ms 0 KB -