Wrong Answer
Code
#include <bits/stdc++.h>
using namespace std;
int main() {
int t;
cin >> t;
while(t--){
int n,q,x;
cin >> n;
int a[n];
for(int i=0;i<n;i++){
cin >> a[i];
}
cin >> q;
int b[q];
for(int i=0;i<q;i++){
cin >> b[i];
}
for(int i=0;i<q;i++){
if(b[i] - 1 == n-b[i]){
cout << n-b[i] << endl;
}else{
cout << min((n-b[i]),(b[i] - 1)) << endl;
}
}
}
return 0;
}
Information
- Submit By
- Type
- Submission
- Problem
- P1079 Roy and Query (Easy Version)
- Contest
- Brain Booster #6
- Language
- C++17 (G++ 13.2.0)
- Submit At
- 2024-10-03 16:30:54
- Judged At
- 2024-11-11 02:48:14
- Judged By
- Score
- 4
- Total Time
- 2ms
- Peak Memory
- 476.0 KiB