#include <iostream>
using namespace std;
long long int k[100005],n,c,r,son[5005][5005],tag[100005];
int GetBestPosition(int N, int C, int R, int *K, int *S, int *E) {
n=N;
c=C;
r=R;
for(int i=0;i<c;i++)
{
long long int cnt=-1;
for(int j=0;j<n;j++)
{
if(tag[j]==0)cnt++;
if(cnt>=S[i] && cnt<=E[i])
{
son[i][0]++;
son[i][son[i][0]]=j;
if(cnt!=0)tag[j]=1;
}
}
}
long long int ans=0,p=0;
for(int i=0;i<n;i++)
{
k[i]=r;
long long int cnt=0;
for(int j=0;j<i;j++)k[j]=K[j];
for(int j=i+1;j<n;j++)k[j]=k[j-1];
long long int ma=0;
for(int l=1;l<=c;l++)
{
for(int j=1;j<=son[i][0];j++)
{
ma=max(son[i][j],ma);
}
if(ma==r)cnt++;
k[son[i][1]]=ma;
}
if(ma>ans)
{
ans=ma;
p=i;
}
}
return p;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
1 ms |
384 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Incorrect |
12 ms |
2176 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Runtime error |
515 ms |
42704 KB |
Execution killed with signal 11 (could be triggered by violating memory limits) |
2 |
Halted |
0 ms |
0 KB |
- |