Submission #1100262

#TimeUsernameProblemLanguageResultExecution timeMemory
1100262vjudge1Maxcomp (info1cup18_maxcomp)C++17
15 / 100
116 ms8952 KiB
#include <cassert> #include <cctype> #include <cerrno> #include <cfloat> #include <ciso646> #include <climits> #include <clocale> #include <cmath> #include <csetjmp> #include <csignal> #include <cstdarg> #include <cstddef> #include <cstdio> #include <cstdlib> #include <cstring> #include <ctime> #include <ccomplex> #include <cfenv> #include <cinttypes> #include <cstdbool> #include <cstdint> #include <ctgmath> #include <cwchar> #include <cwctype> #include <algorithm> #include <bitset> #include <complex> #include <deque> #include <exception> #include <fstream> #include <functional> #include <iomanip> #include <ios> #include <iosfwd> #include <iostream> #include <istream> #include <iterator> #include <limits> #include <list> #include <locale> #include <map> #include <memory> #include <new> #include <numeric> #include <ostream> #include <queue> #include <set> #include <sstream> #include <stack> #include <stdexcept> #include <streambuf> #include <string> #include <typeinfo> #include <utility> #include <valarray> #include <vector> #include <array> #include <atomic> #include <chrono> #include <condition_variable> #include <forward_list> #include <future> #include <initializer_list> #include <mutex> #include <random> #include <ratio> #include <regex> #include <scoped_allocator> #include <system_error> #include <thread> #include <tuple> #include <typeindex> #include <type_traits> #include <unordered_map> #include <unordered_set> #include <random> using namespace std; using ll = long long; #define int long long const int M = 2e5 + 7; const int K = 1e9 + 7; struct custom_hash { static uint64_t splitmix64(uint64_t x) { x += 0x9e3779b97f4a7c15; x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9; x = (x ^ (x >> 27)) * 0x94d049bb133111eb; return x ^ (x >> 31); } size_t operator()(uint64_t x) const { static const uint64_t FIXED_RANDOM = chrono::steady_clock::now().time_since_epoch().count(); return splitmix64(x + FIXED_RANDOM); } }; int b[M], m, k, q, was[M], got[M]; vector<int> g[M]; void dfs(int v, int p, int nd) { if (v == nd) return; was[v] = true; for (auto to : g[v]) { if (to == p) continue; dfs(to, v, nd); } } void dfs(int v, int p) { got[v] = true; for (auto to : g[v]) { if (to == p || was[to]) continue; dfs(to, v); } } inline void Solve() { int m, k; cin >> m >> k; for (int i = 1; i <= k; i++) { cin >> b[i]; } int ans = -1; for (int l = 1; l <= k; l++) { for (int r = l; r <= k; r++) { int sz = 0, mx = 0, mn = 1e18; for (int i = l; i <= r; i++) { sz++; mx = max(mx, b[i]); mn = min(mn, b[i]); } ans = max(ans, (mx - mn - sz)); } } cout << ans; } signed main() { ios::sync_with_stdio(false); cin.tie(nullptr); cout.tie(nullptr); int t = 1; while (t--) { Solve(); } return 0; }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...