General
 
 
# Author Problem Lang Verdict Time Memory Sent Judged  
260624825 Practice:
arghya_G
1971E - 70 C++17 (GCC 7-32) Wrong answer on test 12 827 ms 384 KB 2024-05-12 10:18:23 2024-05-12 10:18:23
→ Source
/**
  author:  Arghya
  created: 12.05.2024 12:24:49
**/
#ifndef ONLINE_JUDGE
#include "debug/debud.h"
#endif
#ifdef ONLINE_JUDGE
#define dbg(x)
#define dbgs(...)
#endif

#include <bits/stdc++.h>
#pragma GCC target("avx2")
#pragma GCC optimize("O3")
#pragma GCC optimize("unroll-loops")
using namespace std;
#define fast_io                                                                \
  ios_base::sync_with_stdio(false);                                            \
  cin.tie(nullptr)
#define ll long long
#define loop(i, a, b) for (int i = a; i < b; i += 1)
#define yn(f) (f) ? cout << "YES\n" : cout << "NO\n"
#define all(a) (a).begin(), (a).end()
#define rall(a) (a).rbegin(), (a).rend()
#define in(...)                                                                \
  int __VA_ARGS__;                                                             \
  input(__VA_ARGS__);
#define endl '\n'
const long long int modu = 1000000007;
template <typename... Args> void input(Args &...args) { ((cin >> args), ...); }
template <typename T1, typename T2>
istream &operator>>(istream &istream, pair<T1, T2> &p) {
  return (istream >> p.first >> p.second);
}
template <typename T> istream &operator>>(istream &istream, vector<T> &v) {
  for (auto &it : v)
    cin >> it;
  return istream;
}
template <typename T>
ostream &operator<<(ostream &ostream, const vector<T> &c) {
  for (auto &it : c)
    ostream << it << " ";
  return ostream;
}
template <typename T> void unique(vector<T> &v) {
  unordered_set<T> seen;
  v.erase(remove_if(v.begin(), v.end(),
                    [&](const T &elem) { return !seen.insert(elem).second; }),
          v.end());
}
#define int ll

void solve() {
  in(n, k, q);
  vector<double> a(k), b(k);
  cin >> a >> b;
  a.insert(a.begin(), 0);
  b.insert(b.begin(), 0);
  while (q--) {
    in(c);
    if (c == a[k]) {
      cout << b[k] << " ";
      continue;
    }
    auto i = upper_bound(all(a), c) - a.begin();
    i--;
    int t = b[i] + (b[i + 1] - b[i]) / (a[i + 1] - a[i]) * (c - a[i]);
    cout.precision(0); // Set precision to 0 to avoid scientific notation
    cout << fixed << t << " ";
  }
  cout << endl;
}

signed main() {
#ifndef ONLINE_JUDGE
  freopen("error.txt", "w", stderr);
#endif
  fast_io;
  int t;
  cin >> t;
  while (t--) {
    solve();
  }
}
?
Time: ? ms, memory: ? KB
Verdict: ?
Input
?
Participant's output
?
Jury's answer
?
Checker comment
?
Diagnostics
?
Click to see test details