Untitled
plain_text
2 months ago
2.3 kB
1
Indexable
Never
#include <bits/stdc++.h> using namespace std; bool testing = false; #define F first #define S second #define ll long long #define tc \ int t; \ cin >> t; \ while (t--) #define all(A) A.begin(), A.end() void fio() { cin.tie(nullptr); cout.tie(nullptr); ios::sync_with_stdio(false); } void file_io(string fname) { freopen((fname + ".in").c_str(), "r", stdin); freopen((fname + ".out").c_str(), "w", stdout); } void file_i(string fname) { freopen((fname + ".in").c_str(), "r", stdin); } void exec_time() { using namespace std::chrono; // Get starting timepoint static auto start = high_resolution_clock::now(); static bool end = false; // Get ending timepoint if (end) { auto stop = high_resolution_clock::now(); // Get duration. Substart timepoints to // get durarion. To cast it to proper unit // use duration cast method auto duration = duration_cast<milliseconds>(stop - start); cout << "\nExec Time :" << duration.count() << " milliseconds\n"; } else end = true; } // ------------------ Global variables declaration --------------------- // int x; int a[] = {12, 15, 15, 19, 24, 31, 53, 59, 60}; // -------------------------------------------------------------------- // //---------------------------------methods------------------------------------- //---------------------------------methods------------------------------------- int main() { // testing = true; fio(); if (testing) { file_io("test"); exec_time(); } //-------------------------------solution-------------------------------- tc { int n; cin >> n; int arr[n]; for (int i = 0; i < n; i++) { cin >> arr[i]; } int r = 0; for (int i = 0; i < n - 1; i++) { if (arr[i] > arr[i + 1]) r = max(r, arr[i]); } cout << r << endl; } //----------------------------------------------------------------------- if (testing) exec_time(); return 0; }