QOJ.ac

QOJ

ID题目提交者结果用时内存语言文件大小提交时间测评时间
#245579#5488. Platform Placingmomen159#WA 0ms3700kbC++141.6kb2023-11-10 03:24:452023-11-10 03:24:47

Judging History

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

  • [2023-11-10 03:24:47]
  • 评测
  • 测评结果:WA
  • 用时:0ms
  • 内存:3700kb
  • [2023-11-10 03:24:45]
  • 提交

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};

int adj[N] , in[N];
ll ans[N] ;
ll answer = 1 ;
bool vis[N] ;

ll dfs(int i){
    if (vis[i])
        return 1;
    vis[i] = 1;
    ll ret = ans[i] ;
    ret*= dfs(adj[i]) ;
    ret%=mod ;
    return ret ;
}


void solve(int z) {
    double n , l,r;
    cin>>n>>l>>r;
    vector<int>v(n) ;
    for (int i = 0; i < n; ++i) {
        cin>>v[i] ;
    }
    sort(all(v)) ;
    ll 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: 3700kb

input:

1 1 100
1

output:

-1

result:

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