제출 #830279

#제출 시각아이디문제언어결과실행 시간메모리
830279skittles1412팀들 (IOI15_teams)C++17
0 / 100
4054 ms18872 KiB
#include "bits/extc++.h" using namespace std; template <typename T, typename... U> void dbgh(const T& t, const U&... u) { cerr << t; ((cerr << " | " << u), ...); cerr << endl; } #ifdef DEBUG #define dbg(...) \ cerr << "L" << __LINE__ << " [" << #__VA_ARGS__ << "]: "; \ dbgh(__VA_ARGS__) #else #define dbg(...) #define cerr \ if (false) \ cerr #endif #define endl "\n" #define long int64_t #define sz(x) int(std::size(x)) template <typename Cb> struct Cmp { Cb cb; Cmp(Cb cb) : cb(cb) {} template <typename T> bool operator()(const T& a, const T& b) const { return cb(a) < cb(b); } }; struct Solver { vector<pair<int, int>> arr; Solver() {} Solver(const vector<pair<int, int>>& _arr) : arr(_arr) { sort(begin(arr), end(arr), Cmp([&](const pair<int, int>& p) -> int { return p.second; })); } bool query(vector<int> q_arr) { int n = sz(arr); if (accumulate(begin(q_arr), end(q_arr), long(0)) > n) { return false; } bool used[n] {}; for (auto& a : q_arr) { int cnt = 0; for (int i = 0; i < n && cnt < a; i++) { if (used[i]) { continue; } if (arr[i].first <= a && a <= arr[i].second) { used[i] = true; cnt++; } } if (cnt != a) { return false; } } return true; } } solver; void init(int n, int arrl[], int arrr[]) { vector<pair<int, int>> arr; for (int i = 0; i < n; i++) { arr.emplace_back(arrl[i], arrr[i]); } solver = Solver(arr); } int can(int m, int arr[]) { return solver.query(vector<int>(arr, arr + m)); }

컴파일 시 표준 에러 (stderr) 메시지

teams.cpp: In constructor 'Cmp<Cb>::Cmp(Cb)':
teams.cpp:31:12: warning: declaration of 'cb' shadows a member of 'Cmp<Cb>' [-Wshadow]
   31 |     Cmp(Cb cb) : cb(cb) {}
      |         ~~~^~
teams.cpp:29:8: note: shadowed declaration is here
   29 |     Cb cb;
      |        ^~
teams.cpp: In instantiation of 'Cmp<Cb>::Cmp(Cb) [with Cb = Solver::Solver(const std::vector<std::pair<int, int> >&)::<lambda(const std::pair<int, int>&)>]':
teams.cpp:45:74:   required from here
teams.cpp:31:12: warning: declaration of 'cb' shadows a member of 'Cmp<Solver::Solver(const std::vector<std::pair<int, int> >&)::<lambda(const std::pair<int, int>&)> >' [-Wshadow]
   31 |     Cmp(Cb cb) : cb(cb) {}
      |         ~~~^~
teams.cpp:29:8: note: shadowed declaration is here
   29 |     Cb cb;
      |        ^~
teams.cpp:31:12: warning: declaration of 'cb' shadows a member of 'Cmp<Solver::Solver(const std::vector<std::pair<int, int> >&)::<lambda(const std::pair<int, int>&)> >' [-Wshadow]
   31 |     Cmp(Cb cb) : cb(cb) {}
      |         ~~~^~
teams.cpp:29:8: note: shadowed declaration is here
   29 |     Cb cb;
      |        ^~
teams.cpp:31:12: warning: declaration of 'cb' shadows a member of 'Cmp<Solver::Solver(const std::vector<std::pair<int, int> >&)::<lambda(const std::pair<int, int>&)> >' [-Wshadow]
   31 |     Cmp(Cb cb) : cb(cb) {}
      |         ~~~^~
teams.cpp:29:8: note: shadowed declaration is here
   29 |     Cb cb;
      |        ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...