제출 #133190

#제출 시각아이디문제언어결과실행 시간메모리
133190ckodser팀들 (IOI15_teams)C++14
34 / 100
4035 ms80148 KiB
#include<bits/stdc++.h>
#include "teams.h"

#define ll long long
#define F first
#define S second
#define pb push_back
#define pii pair<ll,ll>
#define mp make_pair

using namespace :: std;

const ll maxn=5e5+500;
const ll inf=1e9+900;

vector<ll> sar[maxn];;
vector<ll> tah[maxn];
ll s[maxn];
ll e[maxn];
pii tmp[maxn];
void init(int n, int a[], int b[]) {
    for(ll i=0;i<n;i++){
	tmp[i]=mp(b[i],a[i]);
    }
    sort(tmp,tmp+n);
    for(ll i=0;i<n;i++){
	s[i]=tmp[i].S;
	e[i]=tmp[i].F;
	sar[s[i]].pb(i);
	tah[e[i]].pb(i);
    }
}
int can(int m, int k[]) {
    sort(k,k+m);
    ll last=0;
    multiset<ll> st;
    for(ll j=0;j<m;j++){
	ll v=k[j];
	if(last!=v){
	    for(ll i=last;i<v;i++){
		for(auto e:tah[i]){
		    auto it=st.find(e);
		    if(it!=st.end())
			st.erase(it);
		}
		for(auto e:sar[i+1]){
		    st.insert(e);
		}
	    }
	    last=v;
	}
	for(ll i=0;i<v;i++){
	    if(st.empty()){
		return 0;
	    }
	    st.erase(st.begin());
	}
    }
    return 1;
}

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:41:12: warning: declaration of 'e' shadows a global declaration [-Wshadow]
   for(auto e:tah[i]){
            ^
teams.cpp:19:4: note: shadowed declaration is here
 ll e[maxn];
    ^
teams.cpp:46:12: warning: declaration of 'e' shadows a global declaration [-Wshadow]
   for(auto e:sar[i+1]){
            ^
teams.cpp:19:4: note: shadowed declaration is here
 ll e[maxn];
    ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...