# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
849462 | 2023-09-14T16:16:50 Z | Benmath | Measures (CEOI22_measures) | C++14 | 93 ms | 4808 KB |
/****************************************************************************** Online C++ Compiler. Code, Compile, Run and Debug C++ program online. Write your code in this editor and press "Run" button to compile and execute it. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; int broj_ljudi, broj_dodatnih; double maksimalna_udaljenost; double ljudi[200010]; double dodatniljudi[200010]; int check (double mid, vector<double>v){ int provjera = 0; double prethodni = v[0] - mid; for(int i = 1; i < v.size(); i++){ double mogucnost1 = v[i] - mid; double mogucnost2 = v[i] + mid; double moguce = prethodni + maksimalna_udaljenost; if(mogucnost1 >= moguce){ prethodni = mogucnost1; }else if (moguce <= mogucnost2){ prethodni = moguce; }else{ provjera++; break; } } return provjera; } void ispisi(double x){ int x1 = x; double x2 = x1; if(x==x2){ cout<<x1; }else{ cout<<fixed<<setprecision(1)<<x; } cout<<" "; } int main() { cin>>broj_ljudi; cin>>broj_dodatnih; cin>>maksimalna_udaljenost; vector<double>v; for (int i = 0; i < broj_ljudi; i++){ cin >> ljudi[i]; v.push_back(ljudi[i]); } vector<double>ansispis; double ans=0; double maksimum; double two=2; for(int i = 0; i < broj_dodatnih; i++){ cin >> dodatniljudi[i]; if (i == 0){ maksimum = dodatniljudi[i]; ansispis.push_back(ans); }else{ double trenutni = dodatniljudi[i]; if ((trenutni + ans) >= (maksimum + maksimalna_udaljenost)){ maksimum = maksimum + maksimalna_udaljenost; ansispis.push_back(ans); }else{ double izraz = maksimum + maksimalna_udaljenost + ans - trenutni; izraz = izraz / two; ans = izraz; maksimum = trenutni + izraz; ansispis.push_back(ans); } } } for(int i = 0; i < ansispis.size(); i++){ ispisi(ansispis[i]); } }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 1 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 93 ms | 4808 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 93 ms | 4808 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |