Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <algorithm>
- #include <bits/stdc++.h>
- using namespace std ;
- typedef long long ll ;
- int main() {
- ios_base::sync_with_stdio(false) , cin.tie(nullptr) , cout.tie(nullptr) ;
- int n , t ;
- ll count = 0 , MIN = INT_MAX ;
- cin >> t ;
- while (t--) {
- cin >> n ; int arr[n] ;
- for (int i = 1; i <= n ; i++) cin >> arr[i] ;
- for (int i = 1; i <= n; i++) {
- for (int j = i + 1; j <= n; j++) {
- count = arr[i] + arr[j] + j - i ;
- MIN = min(count , MIN) ;
- }
- }
- }
- cout << MIN ;
- return 0 ;
- }
Advertisement
Add Comment
Please, Sign In to add comment