/ SeriousOJ /

Record Detail

Wrong Answer


  
# Status Time Cost Memory Cost
#1 Accepted 1ms 320.0 KiB
#2 Wrong Answer 1ms 320.0 KiB
#3 Wrong Answer 2ms 476.0 KiB

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