/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 1ms 492.0 KiB
#3 Wrong Answer 27ms 560.0 KiB

Code

/*CODED BY mahmudulsakib2019
  DATE:-06/3/2024;TIME:-07:39 pm
  BANGALDESH , SYLHET*/

#include <iostream>
#include <vector>
using namespace std;

int main() {
    int T;
    cin >> T;
    while (T--) {
        int T1, T2, N;
        cin >> T1 >> T2 >> N;
        vector<int> A(N), B(N);
        for (int i = 0; i < N; ++i) cin >> A[i];
        for (int i = 0; i < N; ++i) cin >> B[i];
        int minTrain = min(T1, T2);
        int minTime = 1e9;
        for (int i = 0; i < N; ++i) {
            if (B[i] > minTrain) {
                minTime = min(minTime, max(A[i], N - 1 - A[i]));
            }
        }
        if (minTime == 1e9) {
            cout << -1 << endl;
        } else {
            cout << minTime << endl;
        }
    }
    return 0;
}

Information

Submit By
Type
Submission
Problem
P1030 A boring train journey
Contest
Brain booster #2
Language
C++20 (G++ 13.2.0)
Submit At
2024-03-06 16:51:33
Judged At
2024-11-11 03:41:11
Judged By
Score
10
Total Time
27ms
Peak Memory
560.0 KiB