제출 #831747

#제출 시각아이디문제언어결과실행 시간메모리
831747jlallas384팀들 (IOI15_teams)C++17
34 / 100
4040 ms38392 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; vector<pair<int,int>> seg; void init(int N, int A[], int B[]) { for(int i = 0; i < N; i++){ seg.emplace_back(A[i], B[i]); } sort(seg.begin(), seg.end()); } int can(int m, int K[]) { vector<int> k; for(int i = 0; i < m; i++){ k.push_back(K[i]); } sort(k.begin(), k.end()); multiset<int> ms; int ptr = 0; for(int x: k){ while(ptr < seg.size() && seg[ptr].first <= x){ ms.insert(seg[ptr++].second); } while(ms.size() && *ms.begin() < x){ ms.erase(ms.find(*ms.begin())); } if(ms.size() < x) return 0; for(int it = 0; it < x; it++){ ms.erase(ms.find(*ms.begin())); } } return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:22:13: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   22 |   while(ptr < seg.size() && seg[ptr].first <= x){
      |         ~~~~^~~~~~~~~~~~
teams.cpp:28:16: warning: comparison of integer expressions of different signedness: 'std::multiset<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   28 |   if(ms.size() < x) return 0;
      |      ~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...