제출 #103608

#제출 시각아이디문제언어결과실행 시간메모리
103608AllianceExhibition (JOI19_ho_t2)C++14
50 / 100
393 ms11476 KiB
// In the name of Allah. Ya ali!
#include<bits/stdc++.h>
#define double long double
typedef long long ll;
const ll MAX_N = 1000+10;
const ll MOD = 1e9+7;
using namespace std;

int dp[MAX_N][MAX_N];
pair<int,int> lr[MAX_N];
int a[MAX_N];
int n,m;

int main()
{
    cin >> n >> m;
    for(int i = 1;i<=n;++i)
        scanf("%d%d",&lr[i].second,&lr[i].first);
    for(int i = 1;i<=m;++i)
        scanf("%d",&a[i]);
    sort(a+1,a+m+1);
    sort(lr+1,lr+n+1);
    for(int i = 1;i<=n;++i)
    {
        for(int j = 1;j<=m;++j)
        {
            dp[i][j] = max(dp[i-1][j],dp[i][j-1]);
            if (lr[i].second<=a[j])
                dp[i][j] = max(dp[i][j],dp[i-1][j-1]+1);
        }
    }
    cout << dp[n][m];
    return 0;
}

컴파일 시 표준 에러 (stderr) 메시지

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:18:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d%d",&lr[i].second,&lr[i].first);
         ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:20:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&a[i]);
         ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...