# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
844886 |
2023-09-06T07:04:15 Z |
dosts |
Nivelle (COCI20_nivelle) |
C++14 |
|
621 ms |
2384 KB |
#include <bits/stdc++.h>
#pragma optimize "DostSeferoğlu"
#pragma GCC optimize("unroll-loops,Ofast")
#pragma GCC target("avx2,tune=native")
using namespace std;
#define int long long
#define pii pair<int,int>
#define bg begin
#define vi vector<int>
#define endl '\n'
#define vvi vector<vi>
#define vp vector<pii>
#define sp << " " <<
#define all(x) x.bg()+1,x.end()
#define ff first
#define ss second
#define brake {cout << "OK\n";return;}
#define debug(x) {cout << #x << ": "; for (auto it : x) cout << it << " ";cout << endl;}
#define FF(xxx,sss,yyy) for (int xxx=sss;xxx<=yyy;++xxx)
#define F(xx,yy) for (int xx=1;xx<=yy;++xx)
#define pb push_back
const int inf = 1e18;
const int MOD = 998244353;
const int N = 2e5+1;
void solve() {
int n;
cin >> n;
string s;
cin >> s;
double best = 1.0;
pii ans = {1,1};
for (int x = 1;x<=26;x++) {
for (int p1=1;p1<=n;) {
cerr << p1 << endl;
int p2 = p1;
int mask=(1<<(s[p1-1]-'a'));
while (p2<n && __builtin_popcount(mask|(1<<(s[p2]-'a'))) <= x) {
mask|=(1<<(s[p2]-'a'));
p2++;
}
double v = (double) x/(p2-p1+1);
if (v < best) {
best = v;
ans = {p1,p2};
}
p1 = p2+1;
}
}
cout << ans.ff sp ans.ss << endl;
}
signed main() {
ios_base::sync_with_stdio(0);cin.tie(0);
#ifdef Local
freopen("input.in", "r", stdin);
freopen("input.out", "w", stdout);
#endif
int t = 1;
//cin >> t;
while (t --> 0) solve();
}
Compilation message
nivelle.cpp:2: warning: ignoring '#pragma optimize ' [-Wunknown-pragmas]
2 | #pragma optimize "DostSeferoğlu"
|
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
1 ms |
344 KB |
Output is correct |
2 |
Incorrect |
1 ms |
344 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
14 ms |
344 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
60 ms |
740 KB |
Output is correct |
2 |
Correct |
59 ms |
600 KB |
Output is correct |
3 |
Correct |
57 ms |
600 KB |
Output is correct |
4 |
Correct |
58 ms |
708 KB |
Output is correct |
5 |
Correct |
59 ms |
772 KB |
Output is correct |
6 |
Correct |
116 ms |
848 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
240 ms |
1292 KB |
Output isn't correct |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
621 ms |
2384 KB |
Output is correct |
2 |
Incorrect |
620 ms |
2368 KB |
Output isn't correct |
3 |
Halted |
0 ms |
0 KB |
- |