QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#245580#5488. Platform Placingmomen159#WA 0ms3708kbC++141.4kb2023-11-10 03:25:552023-11-10 03:25:56

Judging History

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

  • [2023-11-10 03:25:56]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3708kb
  • [2023-11-10 03:25:55]
  • 提交

answer

#include<bits/stdc++.h>

using namespace std;
#define ll long long
#define momen ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define endl "\n"
#define ld long double
#define fp(n) for(int i=0;i<n;i++)
#define fp1(n) for(int i=1;i<=n;i++)
#define all(v) v.begin() , v.end()
const int mod = 1e9 + 7, N = 2e5 + 5, M = 8e6 + 5;
const ll LG = 20, inf = 1e9 + 6;


int dx[] = {0, 0, 1, -1};
int dy[] = {1, -1, 0, 0};




void solve(int z) {
    int n ;
    double l,r;
    cin>>n>>l>>r;
    vector<int>v(n) ;
    for (int i = 0; i < n; ++i) {
        cin>>v[i] ;
    }
    sort(all(v)) ;
    double ans = 0 ;
    double dif = v[1] - v[0] ;
    dif -=  l/2 ;
    if (dif < l/2)
        return void(cout<<-1) ;

    ans += min(r ,dif * 2) ;
    double cur = max(l/2 , (dif+l/2) - min(r/2 , dif)) ;
    for (int i = 2; i < n; ++i) {
        dif = v[i] - v[i-1] ;
        if (dif < l)
            return void(cout<<-1) ;
        double move =  min( dif - l/2 , cur ) ;
        ans+= move*2 ;
        cur = dif - move  ;
    }
    ans+= cur*2 ;
    cout<<ans ;

}


int main() {
    momen
    int t = 1;
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r", stdin);
    freopen("output.txt", "w", stdout);
#endif
//    cin >> t;

    for (int i = 1; i <= t; ++i) {
        //cout<<"Case #"<<i<<": ";
        solve(t);
    }

    return 0;
}

詳細信息

Test #1:

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

input:

1 1 100
1

output:

-1

result:

wrong answer 1st lines differ - expected: '100', found: '-1'