fork(1) download
  1. /*
  2. *DIV 2 C.
  3. *LINK:
  4. *nilabja10201992
  5. */
  6. #include <bits/stdc++.h>
  7. using namespace std;
  8.  
  9. #define inf (1<<30)
  10. #define INF (int)1e9
  11. #define EPS 1e-9
  12. #define PI 3.1415926535897932384626433832795
  13. #define MOD 1000000007
  14. #define MAX 1000010
  15.  
  16. int m,k,l;
  17. bool dp[MAX];
  18. void f(){
  19. dp[0]=false;
  20. for(int i=1;i<MAX;i++){
  21. dp[i]=false;
  22. if(i-1>=0 && !dp[i-1]) dp[i]=true;
  23. if(i-k>=0 && !dp[i-k]) dp[i]=true;
  24. if(i-l>=0 && !dp[i-l]) dp[i]=true;
  25. }
  26. }
  27.  
  28. int main() {
  29. ios_base::sync_with_stdio(false);
  30. cin.tie(NULL);
  31. cin>>k>>l>>m;
  32. string str;
  33. int a;
  34. f();
  35. for(int i=0;i<m;i++){
  36. cin>>a;
  37. if(dp[a])
  38. str+='A';
  39. else
  40. str+='B';
  41. }
  42. cout<<str<<endl;
  43. //cout<<"Execution time : "<<tick();
  44. return 0;
  45. }
  46.  
Success #stdin #stdout 0s 17040KB
stdin
Standard input is empty
stdout