func_code_string: #include <bits/stdc++.h>   using namespace std;   const int INF = 1000000001;   const int MAXN = 251;   struct Person {     int cnt, last;     int id;     Person(int id = -1) : id(id) {       cnt = 0;       last = 0;     }     bool operator<(const Person& p) const {       if (cnt != p.cnt) return cnt > p.cnt;       return last < p.last;     }   };   int n, k, m, a;   vector<Person> score;   vector<int> res;   bool can_win(int id) {     vector<Person> tmp(score);     if (m - a > 0) {       tmp[id].cnt += m - a;       tmp[id].last = m - 1;     }     if (tmp[id].cnt == 0) return false;     sort(tmp.begin(), tmp.end());     for (int i = 0; i < k; i++)       if (tmp[i].id == score[id].id) return true;     return false;   }   bool can_lose(int id) {     if (score[id].cnt == 0) return true;     int ptop = a;     int better = id;     for (int j = id + 1; j < n; j++) {       Person cur(score[j]);       while (ptop < m && score[id] < cur) {         cur.cnt++;         cur.last = ptop++;       }       if (cur < score[id]) better++;     }     return better >= k;   }   int main() {     scanf( %d%d%d%d , &n, &k, &m, &a);     score.resize(n);     res.resize(n);     for (int i = 0; i < n; i++) score[i].id = i;     for (int i = 0; i < a; i++) {       int id;       scanf( %d , &id);       id--;       score[id].cnt++;       score[id].last = i;     }     sort(score.begin(), score.end());     for (int i = 0; i < n; i++) {       int val = 0;       bool w = can_win(i);       bool l = can_lose(i);       if (w && l)         val = 2;       else if (w && !l)         val = 1;       else if (!w && l)         val = 3;       else         throw;       res[score[i].id] = val;     }     for (int i = 0; i < n; i++) printf( %d  , res[i]);     puts(  );     return 0;   }   