Submission #402420

# Submission time Handle Problem Language Result Execution time Memory
402420 2021-05-11T16:26:27 Z fadi57 Exhibition (JOI19_ho_t2) C++14
10 / 100
1000 ms 500 KB
#include<bits/stdc++.h>
using namespace std;
const int mx=1002;
typedef long long ll;
int inf=1e9+10;
const int mod=1e9+7;
int n,m;
vector<pair<int,int>>v;
vector<int>f;
int dp[mx][mx];

int solve(int i,int j){

if(i==n){
    return 0;
}
auto it=lower_bound(f.begin()+j,f.end(),v[i].second)-f.begin();


int &ret=dp[i][j];
    ret=solve(i+1,j);

if(it!=f.size()){
    ret=max(ret,solve(i+1,it+1)+1);
}
return ret;

 }
int main(){


  /*  f.push_back(5);  f.push_back(8);
    auto it=lower_bound(f.begin(),f.end(),9)-f.begin();
    cout<<it;
    */
cin>>n>>m;
int s[n];
int vv[n];
for(int i=0;i<n;i++){
    cin>>s[i]>>vv[i];

    v.push_back({vv[i],s[i]});
  }
  sort(v.begin(),v.end());

  for(int i=0;i<m;i++){
    int x;cin>>x;
    f.push_back(x);
  }
  sort(f.begin(),f.end());

 cout<< solve(0,0);
 }

Compilation message

joi2019_ho_t2.cpp: In function 'int solve(int, int)':
joi2019_ho_t2.cpp:23:6: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   23 | if(it!=f.size()){
      |    ~~^~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Execution timed out 1076 ms 500 KB Time limit exceeded
21 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 1 ms 204 KB Output is correct
2 Correct 1 ms 332 KB Output is correct
3 Correct 1 ms 308 KB Output is correct
4 Correct 1 ms 332 KB Output is correct
5 Correct 1 ms 332 KB Output is correct
6 Correct 1 ms 332 KB Output is correct
7 Correct 1 ms 332 KB Output is correct
8 Correct 1 ms 312 KB Output is correct
9 Correct 1 ms 332 KB Output is correct
10 Correct 1 ms 332 KB Output is correct
11 Correct 1 ms 332 KB Output is correct
12 Correct 1 ms 332 KB Output is correct
13 Correct 1 ms 312 KB Output is correct
14 Correct 1 ms 332 KB Output is correct
15 Correct 1 ms 304 KB Output is correct
16 Correct 1 ms 332 KB Output is correct
17 Correct 1 ms 204 KB Output is correct
18 Correct 1 ms 300 KB Output is correct
19 Correct 1 ms 332 KB Output is correct
20 Execution timed out 1076 ms 500 KB Time limit exceeded
21 Halted 0 ms 0 KB -