#include #include #include #include #include using namespace std; const int Max_monster = 1500; const int Max_lv = 100000; const int Max_ans = 30; long save[Max_monster]; //l long my[Max_monster]; //l long com[Max_monster]; //もっと単純に! //save,my体裁 lv*10000+戦闘回数 int main(){ int n; long in; long ans = LONG_MAX; long ansmax; int i,j; long swap; //l cin >> n; for(int i=0; i> in; save[i] = in * 10000; } for(int i=0; i> com[i]; } //ソート関数にてソート sort(save, save+n); //計算部分 for(int starti=0; starti my[j]){ my[j-1] = my[j]; j ++; } my[j-1] = swap; //cout << "戦闘" << ansnow << "→" << ansnow+1 << "\tLV" << lvnow << "→" << lvnow + com[i]/2 << endl; //next i ++; if(i >= n){ i=0; } }while(i != starti); //最高戦闘回数チェックとans更新 ansmax = -1; for(int i=0; i ansmax){ ansmax = my[i] % 10000; } } if(ansmax < ans){ ans = ansmax; } } cout << ans << endl; return 0; }