Submission #821348

# Submission time Handle Problem Language Result Execution time Memory
821348 2023-08-11T09:25:41 Z kebine Ekoeko (COCI21_ekoeko) C++17
0 / 110
1 ms 468 KB
#include <bits/stdc++.h>
#define ll long long
#define longlonginf LONG_LONG_MAX
using namespace std;

ll n,m,x;
ll l,r;
string s;

bool subtask1(){
  for(int i = 0 ; i < n ; i++) if( s[i] != 'a' ) return 0;
  for(int i = n ; i < 2*n ; i++) if( s[i] != 'b' ) return 0;
  return 1;
}

void solve(){
  cin>>n;
  cin>>s;
  if( subtask1() ){
    n--;
    cout<<(n*(n+1))/2<<"\n";
  }
}

int main(){
  int T = 1;
  //cin>>T;
  for(int i = 1 ; i <= T ; i++){
    solve();
  }
  return 0;
}
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 0 ms 212 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 0 ms 212 KB Output is correct
2 Incorrect 1 ms 468 KB Output isn't correct
3 Halted 0 ms 0 KB -