pastebin

Paste Search Dynamic
Recent pastes
max
  1. #include<bits/stdc++.h>
  2. using namespace std;
  3. #define faster() ios_base::sync_with_stdio(0); cin.tie(NULL);cout.tie(NULL);
  4. const int mod=1e9+7;
  5.  
  6. int main(){
  7.         faster()
  8.         int t; cin>>t;
  9.         while(t--){
  10.                 int n;cin>>n;
  11.                 string s;cin>>s;
  12.                 int d[30]={},MAX=0;
  13.  
  14.             for(int i=0;i<s.size();i++){
  15.                 d[i]++;
  16.                 MAX=max(MAX,d[i]);
  17.                 }
  18.                 int k=s.size()-(n-1)*(MAX-1);
  19.                 if(MAX<=k) cout<<1;
  20.                 else cout<<-1;
  21.                 cout<<endl;
  22.         }
  23. }
Parsed in 0.007 seconds