답안 #402422

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
402422 2021-05-11T16:28:07 Z fadi57 Exhibition (JOI19_ho_t2) C++14
50 / 100
184 ms 9616 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;
}
int &ret=dp[i][j];
if(ret!=-1){return ret;}
auto it=lower_bound(f.begin()+j,f.end(),v[i].second)-f.begin();



    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;
    */
    memset(dp,-1,sizeof(dp));
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:25:6: warning: comparison of integer expressions of different signedness: 'long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   25 | if(it!=f.size()){
      |    ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4172 KB Output is correct
2 Correct 2 ms 4172 KB Output is correct
3 Correct 2 ms 4224 KB Output is correct
4 Correct 2 ms 4172 KB Output is correct
5 Correct 3 ms 4172 KB Output is correct
6 Correct 2 ms 4172 KB Output is correct
7 Correct 3 ms 4224 KB Output is correct
8 Correct 3 ms 4172 KB Output is correct
9 Correct 2 ms 4172 KB Output is correct
10 Correct 3 ms 4172 KB Output is correct
11 Correct 3 ms 4172 KB Output is correct
12 Correct 3 ms 4172 KB Output is correct
13 Correct 2 ms 4172 KB Output is correct
14 Correct 2 ms 4172 KB Output is correct
15 Correct 3 ms 4172 KB Output is correct
16 Correct 2 ms 4172 KB Output is correct
17 Correct 3 ms 4172 KB Output is correct
18 Correct 3 ms 4224 KB Output is correct
19 Correct 3 ms 4224 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4172 KB Output is correct
2 Correct 2 ms 4172 KB Output is correct
3 Correct 2 ms 4224 KB Output is correct
4 Correct 2 ms 4172 KB Output is correct
5 Correct 3 ms 4172 KB Output is correct
6 Correct 2 ms 4172 KB Output is correct
7 Correct 3 ms 4224 KB Output is correct
8 Correct 3 ms 4172 KB Output is correct
9 Correct 2 ms 4172 KB Output is correct
10 Correct 3 ms 4172 KB Output is correct
11 Correct 3 ms 4172 KB Output is correct
12 Correct 3 ms 4172 KB Output is correct
13 Correct 2 ms 4172 KB Output is correct
14 Correct 2 ms 4172 KB Output is correct
15 Correct 3 ms 4172 KB Output is correct
16 Correct 2 ms 4172 KB Output is correct
17 Correct 3 ms 4172 KB Output is correct
18 Correct 3 ms 4224 KB Output is correct
19 Correct 3 ms 4224 KB Output is correct
20 Correct 19 ms 4300 KB Output is correct
21 Correct 16 ms 4420 KB Output is correct
22 Correct 4 ms 4300 KB Output is correct
23 Correct 4 ms 4248 KB Output is correct
24 Correct 21 ms 4244 KB Output is correct
25 Correct 29 ms 4300 KB Output is correct
26 Correct 28 ms 4324 KB Output is correct
27 Correct 4 ms 4300 KB Output is correct
28 Correct 4 ms 4300 KB Output is correct
29 Correct 15 ms 4236 KB Output is correct
30 Correct 26 ms 4324 KB Output is correct
31 Correct 40 ms 4300 KB Output is correct
32 Correct 4 ms 4236 KB Output is correct
33 Correct 3 ms 4172 KB Output is correct
34 Correct 15 ms 4300 KB Output is correct
35 Correct 3 ms 4172 KB Output is correct
36 Correct 51 ms 4424 KB Output is correct
37 Correct 53 ms 4300 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 4172 KB Output is correct
2 Correct 2 ms 4172 KB Output is correct
3 Correct 2 ms 4224 KB Output is correct
4 Correct 2 ms 4172 KB Output is correct
5 Correct 3 ms 4172 KB Output is correct
6 Correct 2 ms 4172 KB Output is correct
7 Correct 3 ms 4224 KB Output is correct
8 Correct 3 ms 4172 KB Output is correct
9 Correct 2 ms 4172 KB Output is correct
10 Correct 3 ms 4172 KB Output is correct
11 Correct 3 ms 4172 KB Output is correct
12 Correct 3 ms 4172 KB Output is correct
13 Correct 2 ms 4172 KB Output is correct
14 Correct 2 ms 4172 KB Output is correct
15 Correct 3 ms 4172 KB Output is correct
16 Correct 2 ms 4172 KB Output is correct
17 Correct 3 ms 4172 KB Output is correct
18 Correct 3 ms 4224 KB Output is correct
19 Correct 3 ms 4224 KB Output is correct
20 Correct 19 ms 4300 KB Output is correct
21 Correct 16 ms 4420 KB Output is correct
22 Correct 4 ms 4300 KB Output is correct
23 Correct 4 ms 4248 KB Output is correct
24 Correct 21 ms 4244 KB Output is correct
25 Correct 29 ms 4300 KB Output is correct
26 Correct 28 ms 4324 KB Output is correct
27 Correct 4 ms 4300 KB Output is correct
28 Correct 4 ms 4300 KB Output is correct
29 Correct 15 ms 4236 KB Output is correct
30 Correct 26 ms 4324 KB Output is correct
31 Correct 40 ms 4300 KB Output is correct
32 Correct 4 ms 4236 KB Output is correct
33 Correct 3 ms 4172 KB Output is correct
34 Correct 15 ms 4300 KB Output is correct
35 Correct 3 ms 4172 KB Output is correct
36 Correct 51 ms 4424 KB Output is correct
37 Correct 53 ms 4300 KB Output is correct
38 Incorrect 184 ms 9616 KB Output isn't correct
39 Halted 0 ms 0 KB -