제출 #580958

#제출 시각아이디문제언어결과실행 시간메모리
580958AGENivelle (COCI20_nivelle)C++14
24 / 110
1082 ms596 KiB
#include<bits/stdc++.h> #define F first #define S second #define int long long #define pb push_back using namespace std; const int N=1e6,M=2e3,mod=1e9+7; main() { int n; cin>>n; set<int>st; string s; cin>>s; double ans=1e18; int L,R; for(int i=0;i<n;i++){ st.clear(); for(int j=i;j<n;j++){ st.insert(s[j]); double num=st.size(); double len=(double)j-i+1; if(num/len<ans){ ans=num/len; L=i,R=j; } } } cout<<L+1<<" "<<R+1<<endl; return 0; }

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

nivelle.cpp:11:1: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
   11 | main()
      | ^~~~
nivelle.cpp: In function 'int main()':
nivelle.cpp:39:23: warning: 'R' may be used uninitialized in this function [-Wmaybe-uninitialized]
   39 |     cout<<L+1<<" "<<R+1<<endl;
      |                       ^
nivelle.cpp:39:13: warning: 'L' may be used uninitialized in this function [-Wmaybe-uninitialized]
   39 |     cout<<L+1<<" "<<R+1<<endl;
      |             ^
#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...