Submission #150979

#TimeUsernameProblemLanguageResultExecution timeMemory
150979JustInCaseKing of Chairs (FXCUP4_chairs)C++17
78 / 100
157 ms13004 KiB
#include <bits/stdc++.h> #include "king.h" #define send_info SendInfo #define int32_t int #define int64_t long long int64_t send_info(std::vector< int32_t > w, std::vector< int32_t > c) { std::sort(w.begin(), w.end()); int32_t indW = w.size() - 1, indC = c.size() - 1, ans = 0; while(indW >= 0 && indC >= 0) { if(c[indC] >= w[indW]) { ans++; indW--; indC--; } else { indW--; } } return ans; }
#include <bits/stdc++.h> #include "vassal.h" #define init Init #define maid Maid #define int32_t int #define int64_t long long const int32_t MAX_N = 1e5; std::set< std::pair< int32_t, int32_t > > s; void init(int64_t b, std::vector< int32_t > c) { for(int32_t i = c.size() - 1; i >= c.size() - b; i--) { s.insert({ c[i], i }); } } int32_t maid(int32_t w) { auto it = s.lower_bound({ w, 0 }); if(it != s.end()) { int32_t ans = it->second; s.erase(it); return ans; } return -1; }

Compilation message (stderr)

vassal.cpp: In function 'void Init(long long int, std::vector<int>)':
vassal.cpp:14:34: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
  for(int32_t i = c.size() - 1; i >= c.size() - b; i--) {
                                ~~^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...