Submission
# | When | Author | Problem | Language | CPU | Memory | |
---|---|---|---|---|---|---|---|
4488 | 2022-03-25 21:59:11 | The_crawler | Min Substring | C++ 17 | 2 ms | 3472 kb | Wrong Answer - 6 |
Test Cases
# | CPU | Memory | Points | ||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
1 | 2 ms | 3384 kb | 1 | Accepted | |||||||
2 | 2 ms | 3320 kb | 1 | Accepted | |||||||
3 | 2 ms | 3280 kb | 1 | Accepted | |||||||
4 | 2 ms | 3384 kb | 1 | Accepted | |||||||
5 | 2 ms | 3472 kb | 1 | Accepted | |||||||
6 | 2 ms | 3440 kb | 0 | Wrong Answer | |||||||
7 | 0 ms | 0 kb | 0 | Skipped | |||||||
8 | 0 ms | 0 kb | 0 | Skipped | |||||||
9 | 0 ms | 0 kb | 0 | Skipped | |||||||
10 | 0 ms | 0 kb | 0 | Skipped | |||||||
11 | 0 ms | 0 kb | 0 | Skipped | |||||||
12 | 0 ms | 0 kb | 0 | Skipped | |||||||
13 | 0 ms | 0 kb | 0 | Skipped | |||||||
14 | 0 ms | 0 kb | 0 | Skipped | |||||||
15 | 0 ms | 0 kb | 0 | Skipped | |||||||
16 | 0 ms | 0 kb | 0 | Skipped | |||||||
17 | 0 ms | 0 kb | 0 | Skipped | |||||||
18 | 0 ms | 0 kb | 0 | Skipped |
Source Code
/* Author: Tazim(The_crawler) */ #include<bits/stdc++.h> #define ll long long int #define dec greater<int>() #define lower(s) transform(s.begin(), s.end(), s.begin(), ::tolower); #define upper(s) transform(s.begin(), s.end(), s.begin(), ::toupper); #define prow(n) for(auto i:n)cout<<i<<" ";cout<<endl; #define pcol(n) for(auto i:n)cout<<i<<endl; #define yes cout<<"YES"<<endl; #define no cout<<"NO"<<endl; #define debug(x) cout<<#x<<" = ";_print(x); cout<<endl; /// Debug function using namespace std; ///**** bool sortbysec(const pair<int, int>& a, const pair<int, int>& b) { return (a.second < b.second); } template<class T> void _print(T x) { cout << x; } template<class T> void _print(vector<T>x) { cout << "[ ";for (T i : x)cout << i << " ";cout << "]"; } template<class T> void _print(set<T>x) { cout << "[ ";for (T i : x)cout << i << " ";cout << "]"; } template<class T, class V> void _print(pair<T, V>x) { cout << "{" << x.first << "," << x.second << "} "; } template<class T, class V> void _print(map<T, V>x) { cout << "[ ";for (auto i : x)_print(i);cout << "]"; } template<class T> void _print(multiset<T>x) { cout << "[ ";for (T i : x)cout << i << " ";cout << "]"; } /* Hack my code. It's Easy to Read */ int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); // start string s; cin >> s; int n = s.length(); map <char, int > mp; for (int i = 0; i < n; i++) { mp[s[i]]++; } for (int i = 0; i < s.length(); i++) { if (mp[s[i]] - 1 > 0) { mp[s[i]]--; n--; } else break; } for (int i = s.length() - 1; i >= 0; i--) { if (mp[s[i]] - 1 > 0) { mp[s[i]]--; n--; } else break; } cout << n << endl; return 0; }