/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Accepted 1ms 320.0 KiB
#3 Wrong Answer 9ms 588.0 KiB
#4 Accepted 18ms 1.312 MiB
#5 Accepted 17ms 836.0 KiB
#6 Accepted 17ms 948.0 KiB
#7 Accepted 17ms 824.0 KiB
#8 Accepted 16ms 948.0 KiB
#9 Accepted 16ms 836.0 KiB
#10 Wrong Answer 16ms 632.0 KiB

Code

#include<bits/stdc++.h>
using namespace std;
const long long M=2e5+10,MOD=2000000007;
typedef long long ll;
int fre[26][M];
int main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);
    int t=1;
    cin>>t;
    while(t--){
    
       int n;
      // cin>>n;
       int t1,t2;
       cin>>t1>>t2>>n;
       vector<int>a(n),b(n);
       int mx=MOD;
       for(auto &i:a)cin>>i;
        for(auto &i:b)cin>>i;
        int c=a[n-1];
      for(int i=0;i<n;i++){
          int cur_pos=c-a[i];
          if(cur_pos==a[i])continue;
          if(a[i]<cur_pos){
            if(b[i]>t1){
                mx=min(mx,cur_pos-a[i]);
            }
          }
          if(a[i]>cur_pos){
            if(b[i]>t2)mx=min(mx,a[i]-cur_pos);
          }

      }
      
      if(mx==MOD)mx=-1;
      cout<<mx<<"\n";
    

    
   }
   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 15:52:10
Judged At
2024-11-11 03:41:31
Judged By
Score
80
Total Time
18ms
Peak Memory
1.312 MiB