Submission #1106162

#TimeUsernameProblemLanguageResultExecution timeMemory
1106162atomIzbori (COCI22_izbori)C++17
25 / 110
3046 ms1104 KiB
#include "bits/stdc++.h" // @JASPER'S BOILERPLATE using namespace std; using ll = long long; #ifdef JASPER #include "debug.h" #else #define debug(...) 166 #endif signed main() { cin.tie(0) -> sync_with_stdio(0); #ifdef JASPER freopen("in3", "r", stdin); #endif int n; cin >> n; vector <int> a(n + 1); for (int i = 1; i <= n; ++i) cin >> a[i]; ll ans = 0; for (int l = 1; l <= n; ++l) { map <int, int> cnt; pair <int, int> mx = {0, 0}; for (int r = l; r <= n; ++r) { cnt[a[r]]++; if (cnt[a[r]] > mx.second) { mx = make_pair(a[r], cnt[a[r]]); } if (mx.second > (r - l + 1) / 2) { debug(l, r); ++ans; } } } cout << ans << "\n"; return 0; }

Compilation message (stderr)

Main.cpp: In function 'int main()':
Main.cpp:9:20: warning: statement has no effect [-Wunused-value]
    9 | #define debug(...) 166
      |                    ^~~
Main.cpp:37:17: note: in expansion of macro 'debug'
   37 |                 debug(l, r);
      |                 ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...