/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 532.0 KiB
#2 Wrong Answer 1ms 304.0 KiB
#3 Wrong Answer 27ms 564.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 train1, train2, numStations;
        cin >> train1 >> train2 >> numStations;
        vector<int> stationPositions(numStations), extraLaneLengths(numStations);
        for (int i = 0; i < numStations; ++i) cin >> stationPositions[i];
        for (int i = 0; i < numStations; ++i) cin >> extraLaneLengths[i];
        int shorterTrain = min(train1, train2);
        int shortestWaitTime = 1e9;
        for (int i = 0; i < numStations; ++i) {
            if (extraLaneLengths[i] > shorterTrain) {
                shortestWaitTime = min(shortestWaitTime, max(stationPositions[i], numStations - 1 - stationPositions[i]));
            }
        }
        if (shortestWaitTime == 1e9) {
            cout << -1 << endl;
        } else {
            cout << shortestWaitTime << 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:49:38
Judged At
2024-11-11 03:41:11
Judged By
Score
10
Total Time
27ms
Peak Memory
564.0 KiB