제출 #67033

#제출 시각아이디문제언어결과실행 시간메모리
67033nvmdavaTeams (IOI15_teams)C++17
0 / 100
4032 ms14472 KiB
#include "teams.h"
#include <bits/stdc++.h>
using namespace std;


struct unit{
	int l, r, L, R;
	bool operator<(const unit& rhs) const {
		if(L == rhs.L){
			return R < rhs.R;
		}
		return L < rhs.L;
	}
};

vector<unit> v;
void init(int N, int A[], int B[]) {
	unit t;
	for(int i = 0 ; i < N; i++){
		t.l = A[i];
		t.r = B[i];
		v.push_back(t);
	}
}

int can(int M, int K[]) {
	vector<int> q;
	for(int i = 0; i < M; i++){
		q.push_back(K[i]);
	}
	sort(q.begin(), q.end());
	int i = 0, t = q[0];
	for(auto x : v){
		x.L = lower_bound(q.begin(), q.end(), x.l) - q.begin();
		x.R = upper_bound(q.begin(), q.end(), x.r) - q.begin() - 1;
	}
	sort(v.begin(), v.end());
	for(auto x : v){
		if(x.L > q[i]){
			return 0;
		}
		if(x.R <= q[i]){
			t--;
			if(t == 0){
				i++;
				if(i == M){
					return 1;
				}
				t = q[i];
			}
		}
	}
	return 0;
}

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:34:46: warning: conversion to 'int' from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type {aka long int}' may alter its value [-Wconversion]
   x.L = lower_bound(q.begin(), q.end(), x.l) - q.begin();
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~
teams.cpp:35:58: warning: conversion to 'int' from '__gnu_cxx::__normal_iterator<int*, std::vector<int> >::difference_type {aka long int}' may alter its value [-Wconversion]
   x.R = upper_bound(q.begin(), q.end(), x.r) - q.begin() - 1;
         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...