제출 #133049

#제출 시각아이디문제언어결과실행 시간메모리
133049Mahdi_Jfri팀들 (IOI15_teams)C++14
21 / 100
38 ms8412 KiB
#include "teams.h" #include<bits/stdc++.h> using namespace std; #define ll long long #define pb push_back const int maxn = 1e2 + 20; int dp[maxn] , n , l[maxn] , r[maxn] , p[maxn] , cnt[maxn][maxn]; void init(int N, int a[], int b[]) { n = N; for(int i = 0; i < n; i++) { l[i] = a[i] , r[i] = b[i]; cnt[l[i]][r[i]]++; } for(int i = n; i >= 1; i--) for(int j = i; j <= n; j++) cnt[i][j] += cnt[i + 1][j] + cnt[i][j - 1] - cnt[i + 1][j - 1]; } int can(int m, int k[]) { sort(k , k + m); int sum = 0; for(int i = 1; i <= m; i++) { p[i] = k[i - 1]; sum += p[i]; if(sum > n) return 0; } p[0] = 0; dp[0] = 0; for(int i = 1; i <= m; i++) { dp[i] = -1e9; for(int j = i - 1; j >= 0; j--) dp[i] = max(dp[i] , dp[j] + p[i] + cnt[p[j] + 1][p[i] - 1]); if(dp[i] + cnt[p[i] + 1][n] - n > 0) return 0; } return 1; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...