diff --git a/CMakeLists.txt b/CMakeLists.txt index 30f6d98..8585a85 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -27,4 +27,5 @@ add_executable(Playground insert-sort/main.cc csp-decode/main.cc palin/main.cc - csp-backpack/main.cc) + csp-backpack/main.cc + csp-awarding/main.cc) diff --git a/csp-awarding/main.cc b/csp-awarding/main.cc new file mode 100644 index 0000000..95a4711 --- /dev/null +++ b/csp-awarding/main.cc @@ -0,0 +1,25 @@ +#include +#include + +using namespace std; + +int bkt[1005]; + +int main() { + int n, w; + cin >> n >> w; + + for (int i = 0; i < n; i++) { + int ele; + cin >> ele; + bkt[ele]++; + int tot = 0; + for (int j = 600; j >= 0; j--) { + tot += bkt[j]; + if (tot >= max(1, (i + 1) * w / 100)) { + printf("%d ", j); + break; + } + } + } +} \ No newline at end of file