제출 #541118

#제출 시각아이디문제언어결과실행 시간메모리
541118mosiashvililuka팀들 (IOI15_teams)C++14
0 / 100
4065 ms15960 KiB
#include<bits/stdc++.h> #include "teams.h" using namespace std; long long a,b,c,d,e,i,j,ii,jj,zx,xc,f[500009],dp[500009],k[500009]; pair <long long, long long> p[500009]; void init(int Nn, int Aa[], int Bb[]) { b=Nn; for(i=1; i<=b; i++){ p[i].first=Aa[i-1];p[i].second=Bb[i-1]; k[p[i].first]++;k[p[i].second+1]--; } for(i=1; i<=b; i++) k[i]+=k[i-1]; } long long cost(long long q, long long w){ long long qw=0; for(int h=1; h<=b; h++){ if(p[h].first<=q&&w<=p[h].second) qw++; } return qw; } int can(int Mm, int Kk[]) { a=Mm;zx=0; for(i=1; i<=a; i++){ f[i]=Kk[i-1];zx+=f[i]; } if(zx>b){ return 0; } dp[0]=0; for(i=1; i<=a; i++){ zx=0; for(j=i-1; j>=1; j--){ zx=min(zx,(dp[j]-cost(f[j],f[i]))); } dp[i]=zx+k[f[i]]-f[i]; } zx=0; for(i=1; i<=a; i++){ zx=min(zx,dp[i]); } if(zx<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...