답안 #935062

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
935062 2024-02-28T13:22:47 Z Ludissey Measures (CEOI22_measures) C++17
10 / 100
1500 ms 6488 KB
#include <bits/stdc++.h>
#define int long long
using namespace std;
 
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=2000000000000;
        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>(double)a[i]+mid) {
                    br=true;
                    break;
                }
                lb=bc;
            }
            if(br){
                l=mid;
            }else{
                ans=mid;
                r=mid;
            }
        }
        int roundAns=ans;

        if((double)ans-roundAns<0.25) cout << roundAns << " ";
        else if ((double)ans-roundAns<0.75) cout << roundAns << ".5 ";
        else cout << roundAns+1 << " ";

    }
    cout << "\n";
    return 0;
}

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:21: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]
   21 |             for (int i = 1; i < a.size(); i++)
      |                             ~~^~~~~~~~~~
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 508 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 3 ms 348 KB Output is correct
2 Correct 3 ms 348 KB Output is correct
3 Correct 3 ms 508 KB Output is correct
4 Correct 4 ms 348 KB Output is correct
5 Correct 3 ms 348 KB Output is correct
6 Correct 3 ms 348 KB Output is correct
7 Correct 3 ms 468 KB Output is correct
8 Correct 3 ms 348 KB Output is correct
9 Correct 302 ms 5456 KB Output is correct
10 Correct 354 ms 5468 KB Output is correct
11 Correct 237 ms 6228 KB Output is correct
12 Correct 373 ms 5468 KB Output is correct
13 Correct 244 ms 5724 KB Output is correct
14 Correct 286 ms 5468 KB Output is correct
15 Correct 297 ms 4700 KB Output is correct
16 Incorrect 53 ms 6488 KB Output isn't correct
17 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1540 ms 476 KB Time limit exceeded
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Execution timed out 1540 ms 476 KB Time limit exceeded
2 Halted 0 ms 0 KB -