Submission #691484

#TimeUsernameProblemLanguageResultExecution timeMemory
691484fatemetmhrMeasures (CEOI22_measures)C++17
Compilation error
0 ms0 KiB
// hmmm... na dige chizi baraye goftan namoonde // ~ Be Name Khoda ~ #include <bits/stdc++.h> //#pragma GCC optimize ("Ofast") //#pragma GCC target("avx2") //#pragma GCC optimize("unroll-loops,O3") using namespace std; typedef long long ll; #define pb push_back #define mp make_pair #define all(x) x.begin(), x.end() #define fi first #define se second const int maxn = 1e6 + 10; const int maxn5 = 5e5 + 10; const int maxnt = 1.2e6 + 10; const int maxn3 = 1e3 + 10; const int mod = 1e9 + 7; const ll inf = 1e18; ll d; ll a[maxn5]; inline ll solve(int n){ sort(a, a + n); ll lastpos = a[0], tim = 0; for(int i = 1; i < n; i++){ if(a[i] - lastpos >= d) lastpos = max(lastpos + d, a[i] - tim); else if(a[i] + tim - lastpos >= d) lastpos += d; else{ ll need = d - (a[i] - lastpos) - tim; ll x = lastpos + tim; need /= 2; tim += need; lastpos = x + need; } } return tim; } int main(){ ios_base::sync_with_stdio(false); cin.tie(0); int n, m; cin >> n >> m >> d; d *= 2; for(int i = 0; i < n; i++){ cin >> a[i]; a[i] *= 2; } for(int i = 0; i < m; i++){ cin >> a[i + n]; a[i + n] *= 2; ll ans = solve(i + n + 1); cout << ans / 2 << (ans & 1 ? ".5 " : " ") } }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:65:51: error: expected ';' before '}' token
   65 |         cout << ans / 2 << (ans & 1 ? ".5 " : " ")
      |                                                   ^
      |                                                   ;
   66 |     }
      |     ~