제출 #890775

#제출 시각아이디문제언어결과실행 시간메모리
890775UmairAhmadMirzaMiners (IOI07_miners)C++17
45 / 100
1576 ms604 KiB
#include <bits/stdc++.h> using namespace std; int main(){ int n; cin>>n; string s; cin>>s; int st=0; string a="",b=""; int ans=0; while(st<(1<<n)){ a="",b=""; for (int i = 0; i < n; ++i){ if(st&(1<<i)) a+=s[i]; else b+=s[i]; } int mx1=0,mx2=0; set<char> uni; for (int i = 0; i < a.length(); ++i) { uni.insert(a[i]); mx1+=int(uni.size()); if(i>=2 && a[i]!=a[i-2] && a[i-2]!=a[i-1]) uni.erase(a[i-2]); } uni.clear(); for (int i = 0; i < b.length(); ++i) { uni.insert(b[i]); mx2+=int(uni.size()); if(i>=2 && b[i]!=b[i-2] && b[i-2]!=b[i-1]) uni.erase(b[i-2]); } ans=max(ans,mx1+mx2); st++; } cout<<ans<<endl; return 0; }

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

miners.cpp: In function 'int main()':
miners.cpp:21:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   21 |   for (int i = 0; i < a.length(); ++i)
      |                   ~~^~~~~~~~~~~~
miners.cpp:29:21: warning: comparison of integer expressions of different signedness: 'int' and 'std::__cxx11::basic_string<char>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   29 |   for (int i = 0; i < b.length(); ++i)
      |                   ~~^~~~~~~~~~~~
#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...
#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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...