(UPD: 2024-12-04 14:48 UTC) Judge is not working due to Cloudflare incident. (URL) We can do nothing about it, sorry. After the incident is resolved, we will grade all submissions.

Submission #1104181

#TimeUsernameProblemLanguageResultExecution timeMemory
1104181nasir_bashirovNivelle (COCI20_nivelle)C++17
110 / 110
150 ms592 KiB
// #pragma GCC optimize("O3,unroll-loops") // #pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> using namespace std; #define ll long long #define pii pair<int, int> #define pll pair<ll, ll> #define vi vector<int> #define vl vector<ll> #define vii vector<pii> #define db long double #define vll vector<pll> #define endl '\n' #define all(x) x.begin(), x.end() #define fastio ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define int long long int n; string s; void fmain(){ cin >> n >> s; s = ' ' + s; int l = 0, r = 0, cntt = 0, dis = 0; for(int sz = 1; sz <= 26; sz++){ map<char, int> cnt; int tot = 0, p = 1; for(int i = 1; i <= n; i++){ cnt[s[i]]++; if(cnt[s[i]] == 1) tot++; while(tot > sz){ cnt[s[p]]--; if(cnt[s[p]] == 0) tot--; p++; } if(l == 0 or cntt * (i - p + 1) > tot * (r - l + 1)){ l = p, r = i, cntt = tot; } } } cout << l << " " << r; } signed main(){ int tmr = 1; //cin >> tmr; while(tmr--){ fmain(); } }

Compilation message (stderr)

nivelle.cpp: In function 'void fmain()':
nivelle.cpp:27:33: warning: unused variable 'dis' [-Wunused-variable]
   27 |     int l = 0, r = 0, cntt = 0, dis = 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...
#Verdict Execution timeMemoryGrader output
Fetching results...