Submission #2827265
Source Code Expand
#include "bits/stdc++.h" using namespace std; #define MOD 1000000007 #define INF 1LL<<50 #define fst first #define snd second #define pb push_back #define int long long #define ALL(obj) (obj).begin(), (obj).end() #define FOR(i,a,b) for(int i=(a);i<(b);i++) #define RFOR(i,a,b) for(int i = (b-1);i>=a;i--) #define REP(i,n) FOR(i,0,n) #define RREP(i,n) RFOR(i,0,n) #define ITR(itr,mp) for(int itr = (mp).begin(); itr != (mp).end(); ++itr) #define RITR(itr,mp) for(int itr = (mp).rbegin(); itr != (mp).rend(); ++itr) #define debug(x) cout << #x << " = " << (x) << endl; typedef long long ll; typedef pair<ll,ll> P; signed main(){ ios::sync_with_stdio(false); cin.tie(0); string s; cin >> s; int ans = MOD; REP(i,26){ int pre = s.size(); int cnt = -1; RREP(j,s.size()){ if(s[j]-'a' != i) continue; cnt = max(cnt,pre-j-1); pre = j; } if(pre == s.size()-1) continue; cnt = max(cnt,pre); ans = min(ans,cnt); } cout << ans << endl; return 0; }
Submission Info
Submission Time | |
---|---|
Task | A - Shrinking |
User | cinnamoroll |
Language | C++14 (GCC 5.4.1) |
Score | 0 |
Code Size | 1051 Byte |
Status | WA |
Exec Time | 1 ms |
Memory | 256 KB |
Judge Result
Set Name | Sample | All | ||||||
---|---|---|---|---|---|---|---|---|
Score / Max Score | 0 / 0 | 0 / 300 | ||||||
Status |
|
|
Set Name | Test Cases |
---|---|
Sample | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt |
All | 0_00.txt, 0_01.txt, 0_02.txt, 0_03.txt, 1_00.txt, 1_01.txt, 1_02.txt, 1_03.txt, 1_04.txt, 1_05.txt, 1_06.txt, 1_07.txt, 1_08.txt, 1_09.txt |
Case Name | Status | Exec Time | Memory |
---|---|---|---|
0_00.txt | AC | 1 ms | 256 KB |
0_01.txt | AC | 1 ms | 256 KB |
0_02.txt | AC | 1 ms | 256 KB |
0_03.txt | AC | 1 ms | 256 KB |
1_00.txt | WA | 1 ms | 256 KB |
1_01.txt | AC | 1 ms | 256 KB |
1_02.txt | AC | 1 ms | 256 KB |
1_03.txt | AC | 1 ms | 256 KB |
1_04.txt | AC | 1 ms | 256 KB |
1_05.txt | AC | 1 ms | 256 KB |
1_06.txt | AC | 1 ms | 256 KB |
1_07.txt | AC | 1 ms | 256 KB |
1_08.txt | AC | 1 ms | 256 KB |
1_09.txt | AC | 1 ms | 256 KB |