QOJ.ac

QOJ

IDProblemSubmitterResultTimeMemoryLanguageFile sizeSubmit timeJudge time
#211795#362. SparklersRafi22#0 3ms4640kbC++141.2kb2023-10-12 21:19:412024-07-04 02:19:30

Judging History

你现在查看的是最新测评结果

  • [2024-07-04 02:19:30]
  • 评测
  • 测评结果:0
  • 用时:3ms
  • 内存:4640kb
  • [2023-10-12 21:19:41]
  • 提交

answer

#include <bits/stdc++.h>

#define int long long
#define ll long long
#define ld long double
#define endl '\n'
#define st first
#define nd second
#define pb push_back
#define sz(x) (int)(x).size()
#define all(x) (x).begin(), (x).end()
using namespace std;
int inf=1000000007;
ll infl=1000000000000000007;
int mod=1000000007;
int mod1=998244353;

const int N=1007;

bool DP[N][N];
int a[N];
int n;

void dfs(int l,int r,int w)
{
    DP[l][r]=1;
    int c=r-l+1;
    if(l>1&&!DP[l-1][r])
    {
        if(a[r]-a[l-1]<=c*w) dfs(l-1,r,w);
    }
    if(r<n&&!DP[l][r+1])
    {
        if(a[r+1]-a[l]<=c*w) dfs(l,r+1,w);
    }
}

signed main()
{
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    int k,t;
    cin>>n>>k>>t;
    for(int i=1;i<=n;i++) cin>>a[i];
    int l=0,r=1000000000,sr,ans=inf;
    while(l<=r)
    {
        memset(DP,0,sizeof DP);
        sr=(l+r)/2;
        if(sr*t>1000000000)
        {
            ans=sr;
            r=sr-1;
            continue;
        }
        dfs(k,k,sr*t*2);
        if(DP[1][n])
        {
            ans=sr;
            r=sr-1;
        }
        else l=sr+1;
    }
    cout<<ans;




    return 0;
}
/*
3 2 50
0
200
300
*/

Details

Tip: Click on the bar to expand more detailed information

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 0
Wrong Answer
time: 3ms
memory: 4640kb

input:

10 9 2
0
1117660
2284171
3390084
3568342
4222750
5180454
6186411
6360445
6519656

output:

181102001

result:

wrong answer 1st lines differ - expected: '181102', found: '18110
001'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%