# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
849473 | 2023-09-14T16:25:55 Z | Benmath | Measures (CEOI22_measures) | C++14 | 171 ms | 9308 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){ long long 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 = max(maksimum + maksimalna_udaljenost, trenutni - ans); 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
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 2392 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 103 ms | 5368 KB | Output is correct |
2 | Correct | 153 ms | 9232 KB | Output is correct |
3 | Correct | 150 ms | 9144 KB | Output is correct |
4 | Correct | 96 ms | 7048 KB | Output is correct |
5 | Correct | 124 ms | 8376 KB | Output is correct |
6 | Correct | 124 ms | 7256 KB | Output is correct |
7 | Correct | 168 ms | 8464 KB | Output is correct |
8 | Correct | 133 ms | 7104 KB | Output is correct |
9 | Correct | 141 ms | 6888 KB | Output is correct |
10 | Correct | 159 ms | 9308 KB | Output is correct |
11 | Correct | 171 ms | 7700 KB | Output is correct |
12 | Correct | 151 ms | 8620 KB | Output is correct |
13 | Correct | 140 ms | 6844 KB | Output is correct |
14 | Correct | 123 ms | 8896 KB | Output is correct |
15 | Correct | 148 ms | 8720 KB | Output is correct |
16 | Correct | 132 ms | 6588 KB | Output is correct |
17 | Correct | 123 ms | 8148 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 103 ms | 5368 KB | Output is correct |
2 | Correct | 153 ms | 9232 KB | Output is correct |
3 | Correct | 150 ms | 9144 KB | Output is correct |
4 | Correct | 96 ms | 7048 KB | Output is correct |
5 | Correct | 124 ms | 8376 KB | Output is correct |
6 | Correct | 124 ms | 7256 KB | Output is correct |
7 | Correct | 168 ms | 8464 KB | Output is correct |
8 | Correct | 133 ms | 7104 KB | Output is correct |
9 | Correct | 141 ms | 6888 KB | Output is correct |
10 | Correct | 159 ms | 9308 KB | Output is correct |
11 | Correct | 171 ms | 7700 KB | Output is correct |
12 | Correct | 151 ms | 8620 KB | Output is correct |
13 | Correct | 140 ms | 6844 KB | Output is correct |
14 | Correct | 123 ms | 8896 KB | Output is correct |
15 | Correct | 148 ms | 8720 KB | Output is correct |
16 | Correct | 132 ms | 6588 KB | Output is correct |
17 | Correct | 123 ms | 8148 KB | Output is correct |
18 | Incorrect | 148 ms | 8520 KB | Output isn't correct |
19 | Halted | 0 ms | 0 KB | - |