# | Submission time | Handle | Problem | Language | Result | Execution time | Memory |
---|---|---|---|---|---|---|---|
1108183 | 2024-11-03T08:45:20 Z | mispertion | Measures (CEOI22_measures) | C++17 | 3 ms | 336 KB |
#include<bits/stdc++.h> using namespace std; #pragma GCC optimize("O1") mt19937 rng(chrono::steady_clock::now().time_since_epoch().count()); using ll = long long; using ld = long double; using pii = pair<int, int>; #define F first #define S second const ld PI = 3.1415926535; const int N = 5e5 + 2; const int M = 1e7 + 1; int mod = 998244353; const int infi = INT_MAX; const ll infl = LLONG_MAX; int mult(int a, int b) { return a * 1LL * b % mod; } int sum(int a, int b) { if (a + b < 0) return a + b + mod; if (a + b >= mod) return a + b - mod; return a + b; } ll binpow(ll a, ll n) { if (n == 0) return 1; if (n % 2 == 1) { return binpow(a, n - 1) * a % mod; } else { ll b = binpow(a, n / 2); return b * b % mod; } } int n, m; ld d; vector<ld> x; ld getans(){ ld cur = x[0], ca = 0; for(int i = 1; i < x.size(); i++){ if(x[i] + ca - cur >= d){ ld nx; if(x[i] - cur >= d){ nx = max(x[i] - ca, cur + d); }else{ nx = cur + d; } cur = nx; continue; } ld ad = (d - x[i] - ca + cur) / 2; cur = cur - ad + d; ca += ad; } return ca; } void solve() { cin >> n >> m >> d; for(int i = 1; i <= n; i++){ int ps; cin >> ps; x.push_back((ld)ps); } for(int i = 1; i <= m; i++){ int ps; cin >> ps; x.push_back((ld)ps); sort(x.begin(), x.end()); ll ans = getans() * 2; if(ans % 2 == 0){ cout << ans / 2 << ' '; }else{ cout << fixed << setprecision(1) << (ld)ans / 2 << ' '; } } } signed main() { freopen("in.txt", "r", stdin); ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; while (t--) { solve(); } return 0; }
Compilation message
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 3 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | Verdict | Execution time | Memory | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 336 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |