Submission #151661

#TimeUsernameProblemLanguageResultExecution timeMemory
151661rose0310King of Chairs (FXCUP4_chairs)C++17
95 / 100
244 ms6212 KiB
#include "king.h" #include<algorithm> #include<iostream> using namespace std; long long SendInfo(std::vector<int> W, std::vector<int> C) { int N = W.size(); long long upper = 0; sort(W.begin(), W.end()); sort(C.begin(), C.end()); int cnt = 0; for (auto i : W) { while (cnt<N && i > C[cnt]) cnt++; if (cnt < N && i <= C[cnt]) { upper = i; cnt++; } if (cnt >= N) break; } // cout<<"*"<<upper<<endl; return 1; }
#include "vassal.h" #include<algorithm> #include<iostream> using namespace std; long long BB,N; std::vector<int>CC; void Init(long long B, std::vector<int> C){ N = C.size(); BB = B; CC= C; sort(CC.begin(), CC.end()); } bool v[101010]; int Maid(int W){ //if (BB < W) return -1; int l=0, r=CC.size(), mid; while (l<r) { mid = (l+r) / 2; if (CC[mid] < W) l = mid + 1; else r = mid; // cout << l << mid << r << endl; } while (r>0 && CC[r] == CC[r - 1]) r--; while (r<N && v[r]) r++; if (r >= N) return -1; v[r] = 1; // cout << "===" << r << endl; return r; }

Compilation message (stderr)

king.cpp: In function 'long long int SendInfo(std::vector<int>, std::vector<int>)':
king.cpp:8:12: warning: variable 'upper' set but not used [-Wunused-but-set-variable]
  long long upper = 0;
            ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...