제출 #727226

#제출 시각아이디문제언어결과실행 시간메모리
727226vjudge1팀들 (IOI15_teams)C++11
34 / 100
4041 ms20708 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; const int MAXN = 5e5; int n; int a[MAXN], b[MAXN], ord[MAXN]; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; i++) a[i] = A[i], b[i] = B[i]; iota(ord, ord + n, 0); sort(ord, ord + n, [](int i, int j) { return a[i] < a[j]; }); } int can(int M, int K[]) { priority_queue<int> pq; int j = 0; sort(K, K + M); for (int i = 0; i < M; i++) { while (j < n && a[ord[j]] <= K[i]) pq.emplace(-b[ord[j++]]); while (pq.size() && -pq.top() < K[i]) pq.pop(); if (pq.size() < K[i]) return 0; while (K[i]--) pq.pop(); } return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:27:31: warning: comparison of integer expressions of different signedness: 'std::priority_queue<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   27 |                 if (pq.size() < K[i]) 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...