Submission #149076

#TimeUsernameProblemLanguageResultExecution timeMemory
14907620190901 (#200)King of Chairs (FXCUP4_chairs)C++17
0 / 100
47 ms3008 KiB
#include "king.h" #include <algorithm> int mylower_bound(std::vector<int>& c, int n, int val) { int start = 0, end = n; while (start <= end) { int mid = (start + end) / 2; if (c[mid] < val) start = mid + 1; else end = mid - 1; } return start; } long long SendInfo(std::vector<int> W, std::vector<int> C) { int N = W.size(); sort(W.begin(), W.end()); sort(C.begin(), C.end()); long long cansitbegin = -2; long long cansitend = -2; int X = N - 1; for (int i = N - 1; i >= 0; --i) { int index = mylower_bound(C, X, W[i]); if (index <= X) { if (cansitend == -2) { cansitend = i; cansitbegin = i; } else { cansitbegin = i; } X--; } } return W[cansitend] * 1000001 + W[cansitbegin]; }
#include "vassal.h" int startindex; int start, end; void Init(long long B, std::vector<int> C){ int N = C.size(); start = B % 1000001; end = B / 1000001; for (int i = 0; i < N; ++i) { if (C[i] >= start) { startindex = i; break; } } } int Maid(int W){ if (W < start || W > end) { return -1; } else{ return startindex++; } }
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...