Submission #339706

#TimeUsernameProblemLanguageResultExecution timeMemory
339706prasanth30Miners (IOI07_miners)C++14
0 / 100
12 ms620 KiB
#include <bits/stdc++.h> using namespace std; #define int long long int #define float long double const int INF=1e18; inline void solve(){ int n;cin>>n; int ans=0; string s;cin>>s; for(int i=0;i<n;i++){ if(i==0)ans++; else if(i==1)ans+=1+(s[0]!=s[1]); set<char> ss;ss.insert(s[i]); ss.insert(s[i-1]);ss.insert(s[i-2]); ans+=ss.size(); } cout<<ans; } signed main(){ cin.tie(0)->sync_with_stdio(false); int t=1;//cin>>t; while(t--){ solve(); } }
#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...