Advertisement
yuawn

algo2017_week10_Lowestscore

Dec 6th, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.63 KB | None | 0 0
  1. #include <bits/stdc++.h>
  2. using namespace std;
  3. #define pb push_back
  4. #define ALL(o) (o).begin(),(o).end()
  5. #define fo(n) for(int i=0;i<n;i++)
  6.  
  7. struct ccc{
  8.     int score;
  9.     char clas;
  10. };
  11.  
  12. bool cmp( ccc a , ccc b ){ return a.score < b.score; }
  13.  
  14. int main(){
  15.    
  16.     int T;
  17.    
  18.     cin >> T;
  19.    
  20.     while( T-- ){
  21.         int n , now = -1;
  22.         char c = 'A';
  23.        
  24.         vector<ccc> p;
  25.        
  26.         cin >> n;
  27.        
  28.        
  29.         fo( n ){
  30.             ccc tmp;
  31.             cin >> tmp.score;
  32.             if( tmp.score < now ) c = 'B';
  33.             now = tmp.score;
  34.             tmp.clas = c;
  35.             p.pb( tmp );
  36.         }
  37.        
  38.         sort( ALL(p) , cmp );
  39.        
  40.         fo( 3 ) putchar( p[i].clas );
  41.        
  42.         puts("");
  43.        
  44.     }
  45.  
  46.     return 0;
  47. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement