//g++ 2.cpp -std=c++14 -O2 -I . #include using namespace std; #include using namespace atcoder; using ll = long long; using ld = long double; using vi = vector; using vvi = vector; using vll = vector; using vvll = vector; using vld = vector; using vvld = vector; using vst = vector; using vvst = vector; #define fi first #define se second #define pb push_back #define eb emplace_back #define pq_big(T) priority_queue,less> #define pq_small(T) priority_queue,greater> #define all(a) a.begin(),a.end() #define rep(i,start,end) for(ll i=start;i<(ll)(end);i++) #define per(i,start,end) for(ll i=start;i>=(ll)(end);i--) #define uniq(a) sort(all(a));a.erase(unique(all(a)),a.end()) int op(int a,int b){ return (int)(a+b); } int e(){ return 0; } string agct = "AGCT"; int add=0; vi cnt(26,0); // [i] := 元々'A'+i だったのがいくつあるか = 今は 'A'+i+add int cntagct(){ int res=0; for(char c:agct){ int d=c-'A'; res+=cnt[(d-add%26+26*100)%26]; } return res; } int main(){ ios::sync_with_stdio(false); cin.tie(nullptr); int n; string s; cin>>n>>s; segtree seg(vi(n,1)); for(char c:s){ cnt[c-'A']++; } int ans=0; while(true){ int c1=cntagct(); if(!c1){ cout<1){ int ch=(ng+ok)/2; if(seg.prod(0,ch+1)