제출 #765167

#제출 시각아이디문제언어결과실행 시간메모리
765167SanguineChameleon팀들 (IOI15_teams)C++17
21 / 100
4078 ms16332 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; const int maxN = 5e5 + 20; const int maxM = 2e5 + 20; int A[maxN]; int B[maxN]; int N; int get(int lx, int rx, int ly) { if (lx > rx) { return 0; } int cnt = 0; for (int i = 0; i < N; i++) { if (lx <= A[i] && A[i] <= rx && B[i] >= ly) { cnt++; } } return cnt; } void init(int _N, int _A[], int _B[]) { N = _N; for (int i = 0; i < N; i++) { A[i] = _A[i]; B[i] = _B[i]; } } int dp[maxM]; int can(int M, int K[]) { long long sum = 0; for (int i = 0; i < M; i++) { sum += K[i]; } if (sum > N) { return 0; } sort(K, K + M); for (int i = 0; i < M; i++) { dp[i] = get(1, K[i], K[i]) - K[i]; for (int j = 0; j < i; j++) { dp[i] = min(dp[i], dp[j] + get(K[j] + 1, K[i], K[i]) - K[i]); } if (dp[i] < 0) { return false; } } return true; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...