Submission #153533

#TimeUsernameProblemLanguageResultExecution timeMemory
153533phparkKing of Chairs (FXCUP4_chairs)C++17
95 / 100
156 ms13364 KiB
#include "king.h" using namespace std; long long SendInfo(vector <int> W, vector <int> C) { return 1; }
#include <set> #include <iostream> #include <vector> #include <algorithm> #include <utility> #include "vassal.h" using namespace std; static multiset <pair<int, int>> sit; static vector <int> chair; static int N; typedef pair <int, int> pii; pii p; void Init(long long B, vector <int> C) { N = C.size(); chair = C; for (int i = 0; i < N; i++) { p.first = chair[i]; p.second = i; sit.insert(p); } } int Maid(int w) { int left = 0, right = N; auto itr = sit.lower_bound(make_pair(w, 0)); if (itr == sit.end()) { return -1; } else { pair <int, int> ans = *itr; //고른 의자 무게 int answer = ans.second; sit.erase(itr); return answer; } }

Compilation message (stderr)

vassal.cpp: In function 'int Maid(int)':
vassal.cpp:29:6: warning: unused variable 'left' [-Wunused-variable]
  int left = 0, right = N;
      ^~~~
vassal.cpp:29:16: warning: unused variable 'right' [-Wunused-variable]
  int left = 0, right = N;
                ^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...