| # | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
|---|---|---|---|---|---|---|---|
| 462480 | Jasiekstrz | Nivelle (COCI20_nivelle) | C++17 | 44 ms | 708 KiB |
이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include<bits/stdc++.h>
#define fi first
#define se second
using namespace std;
const int N=1e5;
struct Ans
{
int l,r;
int a,b;
bool operator<(const Ans &oth) const
{
return a*oth.b<oth.a*b;
}
};
int cnt[300];
int main()
{
ios_base::sync_with_stdio(false);
cin.tie(NULL);
cout.tie(NULL);
int n;
string s;
Ans ans={1,1,1,1};
cin>>n>>s;
for(int c=1;c<='z'-'a'+1;c++)
{
for(int i=1,j=0,tmp=0;i<=n;)
{
if(j<n && tmp<=c)
{
j++;
cnt[s[j-1]]++;
if(cnt[s[j-1]]==1)
tmp++;
}
else
{
cnt[s[i-1]]--;
if(cnt[s[i-1]]==0)
tmp--;
i++;
}
ans=min(ans,(Ans){i,j,tmp,j-i+1});
}
}
cout<<ans.l<<" "<<ans.r<<"\n";
return 0;
}
컴파일 시 표준 에러 (stderr) 메시지
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
| # | Verdict | Execution time | Memory | Grader output |
|---|---|---|---|---|
| Fetching results... | ||||
