답안 #934704

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
934704 2024-02-27T20:13:09 Z Ludissey Measures (CEOI22_measures) C++14
0 / 100
1500 ms 1040 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
const int mod=1e9+7;
 
signed main() {
    ios_base::sync_with_stdio(false); cin.tie(nullptr);
	int n,m,D; cin >> n >> m >> D;
    vector<int> a(n);
    for (int i = 0; i < n; i++) cin >> a[i];
    for (int _i = 0; _i < m; _i++)
    {
        int x; cin >> x;
        a.push_back(x);
        sort(a.begin(),a.end());
        double l=0,r=4294967296;
        double ans=0;
        while(r-l>=0.1){
            double mid=(l+r)/(double)2;
            double lb=a[0]-mid;
            bool br=false;
            for (int i = 1; i < a.size(); i++)
            {
                double bc=max(lb+(double)D, (double)a[i]-mid);
                if(bc>a[i]+mid) {
                    br=true;
                    break;
                }
                lb=bc;
            }
            if(br){
                l=mid;
            }else{
                ans=mid;
                r=mid;
            }
        }
        int roundAns=rint(ans*(double)2);
        cout << (double)roundAns/2 << " ";
    }
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:22:31: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<long long int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |             for (int i = 1; i < a.size(); i++)
      |                             ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 344 KB Output is correct
2 Incorrect 2 ms 348 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1516 ms 1040 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1516 ms 1040 KB Time limit exceeded
2 Halted 0 ms 0 KB -