QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#502252#323. HillsYassirSalama0 0ms3808kbC++141.0kb2024-08-03 02:01:462024-08-03 02:01:47

Judging History

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

  • [2024-08-03 02:01:47]
  • 评测
  • 测评结果:0
  • 用时:0ms
  • 内存:3808kb
  • [2024-08-03 02:01:46]
  • 提交

answer

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n;
    cin>>n;
    vector<int> v(n);
    for(int i=0;i<n;i++){
        cin>>v[i];
    }
    bool spec[n];
    memset(spec,false,sizeof(spec));
    int ans=0;
    for(int i=0;i<(n+1)/2;i++){
        set<vector<int>> s;
        for(int i=0;i<n;i++){
            //make i spec
            if(spec[i]) continue;
            int cost=0;
            int a=0;
            int b=v[i];
            int c=0;
            if(i) a=v[i-1];
            if(i+1<n) c=v[i+1];
            if(i&&v[i]<=v[i-1]){
                cost+=v[i-1]-v[i]+1;
                a=v[i]-1;
            }
            if(i+1<n&&v[i]<=v[i+1]){
                cost+=v[i+1]-v[i]+1;
                c=v[i+1]-1;
            }
            s.insert({cost,a,b,c,i});
        }
        auto it=s.begin();
        ans+=(*it)[0];
        cout<<ans<<" ";
        spec[(*it)[4]]=1;
        int ind=(*it)[4];
        if(ind) v[ind-1]=(*it)[1];
        if(ind+1<n) v[ind+1]=(*it)[3];
    }
    cout<<endl;
}

詳細信息

Subtask #1:

score: 0
Wrong Answer

Test #1:

score: 7
Accepted
time: 0ms
memory: 3464kb

input:

3
1 2 4

output:

0 2 

result:

ok 2 number(s): "0 2"

Test #2:

score: 7
Accepted
time: 0ms
memory: 3516kb

input:

3
3 2 1

output:

0 2 

result:

ok 2 number(s): "0 2"

Test #3:

score: 7
Accepted
time: 0ms
memory: 3596kb

input:

3
1 2 1

output:

0 2 

result:

ok 2 number(s): "0 2"

Test #4:

score: 7
Accepted
time: 0ms
memory: 3808kb

input:

3
3 3 3

output:

1 1 

result:

ok 2 number(s): "1 1"

Test #5:

score: 0
Wrong Answer
time: 0ms
memory: 3576kb

input:

3
50 80 80

output:

1 3 

result:

wrong answer 2nd numbers differ - expected: '31', found: '3'

Subtask #2:

score: 0
Skipped

Dependency #1:

0%

Subtask #3:

score: 0
Skipped

Dependency #1:

0%

Subtask #4:

score: 0
Skipped

Dependency #1:

0%

Subtask #5:

score: 0
Skipped

Dependency #1:

0%

Subtask #6:

score: 0
Skipped

Dependency #1:

0%