Submission #148663

#TimeUsernameProblemLanguageResultExecution timeMemory
148663usa1+samsung2 (#200)King of Chairs (FXCUP4_chairs)C++17
17 / 100
1099 ms1152 KiB
#include "king.h" #include <algorithm> #include <vector> using namespace std; long long SendInfo(std::vector<int> W, std::vector<int> C) { int N = C.size(); vector<bool> x(N, false); long long ret = 0; sort(C.begin(), C.end()); for(const auto& w : W) { auto it = lower_bound(C.begin(), C.end(), w); while (it!=C.end()) { int i = it-C.begin(); if(!x[i]) { x[i] = true; ret++; } it++; } } return ret; }
#include "vassal.h" #include <vector> #include <utility> #include <algorithm> #include <tuple> using namespace std; long long BB; vector<tuple<int,int>> C_rev; vector<int> C_; vector<bool> x; void Init(long long B, std::vector<int> C){ x = vector<bool>(C.size(), false); for(int i = 0 ; i < C.size(); i++) { C_rev.emplace_back(C[i], i); } C_ = move(C); sort(C_.begin(), C_.end()); sort(C_rev.begin(), C_rev.end()); } int Maid(int W){ auto it = lower_bound(C_.begin(), C_.end(), W); while (it!=C_.end()) { int i = it-C_.begin(); if(!x[i]) { x[i] = true; return get<1>(C_rev[i]); } it++; } return -1; }

Compilation message (stderr)

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