답안 #864577

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
864577 2023-10-23T09:09:09 Z mychecksedad Measures (CEOI22_measures) C++17
35 / 100
35 ms 5468 KB
/* Author : Mychecksdead  */
#include<bits/stdc++.h>
using namespace std;
#define ll long long int
#define MOD (1000000000+7)
#define MOD1 (998244353)
#define pb push_back
#define all(x) x.begin(), x.end()
#define en cout << '\n'
const int N = 1e6+100, M = 1e5+10, K = 52, MX = 30;
const double eps = 1e-5;

int n, m;
ll D;
bool check(ll m, vector<ll> &v){
  ll last = 1e18;
  for(int i = v.size() - 1; i >= 0; --i){
    if(last < v[i] - m){
      return 0;
    }
    last = min(last - D, v[i] + m - D);
  }
  return 1;
}
// ll solv(vector<ll> &v){
  // sort(all(v));
  // ll l = 0, r = 1e18, ans = 1e18;
  // while(l <= r){
  //   ll m = l+r>>1;
  //   if(check(m, v)){
  //     ans = m;
  //     r = m - 1;
  //   }else l = m + 1;
  // }
  // return ans;
// }
void solve(){
  cin >> n >> m >> D;
  D *= 2;
  vector<ll> pos(n);
  for(int i = 0; i < n; ++i){
    cin >> pos[i];
    pos[i] *= 2;
  }
  ll ans = 0, last = -1e18;
  for(int i = 1; i <= m; ++i){
    ll x; cin >> x;
    x *= 2;
    if(x + ans < last){
      ll delta = (last - (x + ans)) / 2;
      ans += delta;
      last -= delta;
    }
    last = max(last, x - ans) + D;
    if(ans % 2 == 0) cout << ans / 2 << ' ';
    else cout << ans/2 << ".5" << ' ';
  }
}


int main(){
  cin.tie(0); ios::sync_with_stdio(0);
  int tt = 1, aa;
  // freopen("in.txt", "r", stdin);
  // freopen("out.txt", "w", stdout);
  while(tt--){
    solve();
  }
  cerr<<"time taken : "<<(float)clock()/CLOCKS_PER_SEC<<" seconds\n";
  return 0;
} 

Compilation message

Main.cpp: In function 'int main()':
Main.cpp:63:15: warning: unused variable 'aa' [-Wunused-variable]
   63 |   int tt = 1, aa;
      |               ^~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 348 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 3164 KB Output is correct
2 Correct 32 ms 5132 KB Output is correct
3 Correct 31 ms 5200 KB Output is correct
4 Correct 30 ms 3012 KB Output is correct
5 Correct 30 ms 4368 KB Output is correct
6 Correct 28 ms 3408 KB Output is correct
7 Correct 33 ms 4428 KB Output is correct
8 Correct 28 ms 3156 KB Output is correct
9 Correct 28 ms 2908 KB Output is correct
10 Correct 32 ms 5468 KB Output is correct
11 Correct 30 ms 3928 KB Output is correct
12 Correct 31 ms 4944 KB Output is correct
13 Correct 29 ms 3048 KB Output is correct
14 Correct 35 ms 5240 KB Output is correct
15 Correct 31 ms 5200 KB Output is correct
16 Correct 30 ms 2572 KB Output is correct
17 Correct 31 ms 4452 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 27 ms 3164 KB Output is correct
2 Correct 32 ms 5132 KB Output is correct
3 Correct 31 ms 5200 KB Output is correct
4 Correct 30 ms 3012 KB Output is correct
5 Correct 30 ms 4368 KB Output is correct
6 Correct 28 ms 3408 KB Output is correct
7 Correct 33 ms 4428 KB Output is correct
8 Correct 28 ms 3156 KB Output is correct
9 Correct 28 ms 2908 KB Output is correct
10 Correct 32 ms 5468 KB Output is correct
11 Correct 30 ms 3928 KB Output is correct
12 Correct 31 ms 4944 KB Output is correct
13 Correct 29 ms 3048 KB Output is correct
14 Correct 35 ms 5240 KB Output is correct
15 Correct 31 ms 5200 KB Output is correct
16 Correct 30 ms 2572 KB Output is correct
17 Correct 31 ms 4452 KB Output is correct
18 Incorrect 31 ms 4436 KB Output isn't correct
19 Halted 0 ms 0 KB -