Submission #110484

#TimeUsernameProblemLanguageResultExecution timeMemory
110484Breno_XDExhibition (JOI19_ho_t2)C++14
50 / 100
72 ms5260 KiB
#include <bits/stdc++.h> using namespace std; #define x first #define y second typedef pair<int,int> pii; const int MAXN = 1100; int N,M, DP[MAXN][MAXN]; int quadro[MAXN]; pii vetor[MAXN]; int compara(pair<int,int> a, pair<int,int> b){ if(a.y == b.y) return a.x < b.x; return a.y<b.y; } int dp(int id, int tipo){ //Casos Base if(DP[id][tipo]>=0) return DP[id][tipo]; if(id>N) return DP[id][tipo] = 0; if(tipo>M) return DP[id][tipo] = 0; int a = dp(id+1, tipo); int b = dp(id, tipo+1); int c = -1; if(vetor[id].x <= quadro[tipo]) c = 1+dp(id+1, tipo+1); int ans = max(a,b); ans = max(ans, c); return DP[id][tipo] = ans; } int main(){ memset(DP, -1, sizeof(DP)); scanf("%d%d", &N, &M); for(int i = 1; i<=N; i++) scanf("%d%d", &vetor[i].x, &vetor[i].y); for(int i = 1; i<=M; i++) scanf("%d", &quadro[i]); sort(vetor+1, vetor+N+1, compara); sort(quadro+1, quadro+M+1); cout << dp(1,1) << endl; return 0; }

Compilation message (stderr)

joi2019_ho_t2.cpp: In function 'int main()':
joi2019_ho_t2.cpp:39:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d%d", &N, &M);
     ~~~~~^~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:40:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i<=N; i++) scanf("%d%d", &vetor[i].x, &vetor[i].y);
                               ~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
joi2019_ho_t2.cpp:41:36: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     for(int i = 1; i<=M; i++) scanf("%d", &quadro[i]);
                               ~~~~~^~~~~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...