답안 #915213

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
915213 2024-01-23T13:43:50 Z Aiperiii Exhibition (JOI19_ho_t2) C++14
0 / 100
1 ms 2652 KB
#include <bits/stdc++.h>
#define int long long
#define ff first
#define ss second
#define pb push_back
#define all(x) x.begin(),x.end()
using namespace std;
const int N=1e3+5;
int dp[N][N],prm[N][N];
signed main(){
   int n,m;
   cin>>n>>m;
   vector <pair <int,int> > v(n);
   vector <int> c(m);
   for(int i=0;i<n;i++){
      cin>>v[i].ff>>v[i].ss;
      swap(v[i].ff,v[i].ss);
   }
   for(int i=0;i<m;i++){
      cin>>c[i];
   }
   sort(all(v));
   sort(all(c));
   for(int i=0;i<n;i++){
      for(int j=0;j<m;j++){
         if(v[i].ss<=c[j])dp[i][j]=1;
         if(i-1>=0 && j-1>=0)dp[i][j]+=dp[i-1][j-1];
         if(j-1>=0)prm[i][j]=max(dp[i][j],prm[i][j-1]);
         else prm[i][j]=dp[i][j];
      }
   }
   cout<<dp[n-1][m-1]<<"\n";
}



/*
 3 4 10 20 51 35
 4
 6
 10
 4
 
8 8
508917604 35617051
501958939 840246141
485338402 32896484
957730250 357542366
904165504 137209882
684085683 775621730
552953629 20004459
125090903 607302990
433255278
979756183
28423637
856448848
276518245
314201319
666094038
149542543
*/
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2496 KB Output is correct
4 Correct 0 ms 444 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Incorrect 1 ms 2396 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2496 KB Output is correct
4 Correct 0 ms 444 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Incorrect 1 ms 2396 KB Output isn't correct
8 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 0 ms 344 KB Output is correct
2 Correct 1 ms 2392 KB Output is correct
3 Correct 1 ms 2496 KB Output is correct
4 Correct 0 ms 444 KB Output is correct
5 Correct 0 ms 344 KB Output is correct
6 Correct 1 ms 2652 KB Output is correct
7 Incorrect 1 ms 2396 KB Output isn't correct
8 Halted 0 ms 0 KB -