Skip to content

Commit

Permalink
11525 solved
Browse files Browse the repository at this point in the history
  • Loading branch information
ksaveljev committed May 14, 2012
1 parent 7c004f9 commit c953021
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions 11525.cpp
@@ -0,0 +1,49 @@
#include <iostream>
#include <vector>
using namespace std;

#define REP(i, b, n) for (int i = b; i < n; i++)
#define rep(i, n) REP(i, 0, n)

int main(void) {
ios::sync_with_stdio(false);

int k, number_of_cases, tmp;

cin >> number_of_cases;

while (number_of_cases--) {
cin >> k;

vector<int> nums[501];

REP (i, 1, k+1) {
nums[i/500].push_back(i);
}

bool first = true;

while (k--) {
cin >> tmp;

if (!first)
cout << " ";
else
first = false;

int index = 0;

while (tmp >= nums[index].size()) {
tmp -= nums[index].size();
index++;
}

cout << nums[index][tmp];
nums[index].erase(nums[index].begin() + tmp);
}

cout << endl;
}

return 0;
}

0 comments on commit c953021

Please sign in to comment.