(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.

제출 #206480

#제출 시각아이디문제언어결과실행 시간메모리
206480rzbtNivelle (COCI20_nivelle)C++14
110 / 110
50 ms508 KiB
#include <bits/stdc++.h> #define mp make_pair #define pb push_back #define all(x) x.begin(),x.end() #define MAXN 100005 using namespace std; int n; char s[MAXN]; set<int> gde; int niz[29]; int l=1,r=1,razl=1; int main() { scanf("%d", &n); scanf("%s",s); gde.insert(0); for(int i=1;i<=n;i++){ int slovo=s[i-1]-'a'; if(niz[slovo])gde.erase(-niz[slovo]); niz[slovo]=i; gde.insert(-i); niz[slovo]=i; int broj=0; for(auto x:gde){ //printf(" %d %d %d\n",i,x,broj); //printf(" %d %d %d %d\n",r-l+1,razl,i+x,broj); if(broj && (broj*(r-l+1)<(i+x)*razl)){ l=-x+1; r=i; razl=broj; } broj++; } } printf("%d %d",l,r); return 0; }

컴파일 시 표준 에러 (stderr) 메시지

nivelle.cpp: In function 'int main()':
nivelle.cpp:16:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
nivelle.cpp:17:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%s",s);
     ~~~~~^~~~~~~~
#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...