/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 2ms 400.0 KiB
#2 Wrong Answer 1ms 532.0 KiB
#3 Wrong Answer 9ms 580.0 KiB

Code

#include <bits/stdc++.h>

#pragma GCC optimize("Ofast")
using namespace std;

void solve(int cs) {
  int la, lb;
  cin >> la >> lb;
  int n;
  cin >> n;
  vector<int> a(n);
  vector<int> l(n);
  for (int &i : a) cin >> i;
  for (int &i : l) cin >> i;

  int res = 1e9;
  for (int i = 0; i < n; i++) {
    if (min(la, lb) <= l[i]) {
      res = min(res, abs(a[i] - (a.back() - a[i])));
    }
  }

  cout << (res == 1e9 ? -1 : res) << "\n";
}

int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int tc = 1;
  cin >> tc;
  for (int cs = 1; cs <= tc; cs++) {
    solve(cs);
  }
  return 0;
}

Information

Submit By
Type
Submission
Problem
P1030 A boring train journey
Language
C++20 (G++ 13.2.0)
Submit At
2024-07-14 08:18:15
Judged At
2024-11-11 03:26:23
Judged By
Score
10
Total Time
9ms
Peak Memory
580.0 KiB