Submission #1059675

#TimeUsernameProblemLanguageResultExecution timeMemory
1059675becaido송신탑 (IOI22_towers)C++17
14 / 100
637 ms2132 KiB
#pragma GCC optimize("O3,unroll-loops") #pragma GCC target("avx,popcnt,sse4,abm") #include <bits/stdc++.h> using namespace std; #ifndef WAIMAI #include "towers.h" #else #include "stub.cpp" #endif #ifdef WAIMAI #define debug(HEHE...) cout << "[" << #HEHE << "] : ", dout(HEHE) void dout() {cout << '\n';} template<typename T, typename...U> void dout(T t, U...u) {cout << t << (sizeof...(u) ? ", " : ""), dout(u...);} #else #define debug(...) 7122 #endif #define ll long long #define Waimai ios::sync_with_stdio(false), cin.tie(0) #define FOR(x,a,b) for (int x = a, I = b; x <= I; x++) #define pb emplace_back #define F first #define S second const int SIZE = 1e5 + 5; int n; int a[SIZE], pre[SIZE]; void init(int N, vector<int> H) { n = N; FOR (i, 1, n) a[i] = H[i - 1]; FOR (i, 2, n - 1) pre[i] = pre[i - 1] + (a[i] < min(a[i - 1], a[i + 1])); } int max_towers(int L, int R, int D) { L++, R++; if (L == R) return 1; int ans = pre[R - 1] - pre[L]; ans += (a[L] < a[L + 1]); ans += (a[R] < a[R - 1]); return ans; } /* in1 7 3 10 20 60 40 50 30 70 1 5 10 2 2 100 0 6 17 out1 3 1 2 */
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...