제출 #411557

#제출 시각아이디문제언어결과실행 시간메모리
411557faresbasbs팀들 (IOI15_teams)C++14
0 / 100
4066 ms8632 KiB
#include <bits/stdc++.h> #include "teams.h" using namespace std; vector<pair<int,int>> all; int n; void init(int N , int A[] , int B[]){ n = N; for(int i = 0 ; i < n ; i += 1){ all.push_back({A[i],B[i]}); } sort(all.rbegin(),all.rend()); } int can(int m , int k[]){ bool seen[n]; memset(seen,0,sizeof seen); vector<int> f; for(int i = 0 ; i < m ; i += 1){ f.push_back(k[i]); } sort(f.rbegin(),f.rend()); vector<int> f2 = f; int tag = 0; for(int l = 0 ; l < m ; l += 1){ for(int j = 0 ; j < n ; j += 1){ if(seen[j]){ continue; } auto i = all[j]; if(i.first <= f2[tag] && i.second >= f2[tag]){ seen[j] = 1; f[tag] -= 1; } if(f[tag] == 0){ tag += 1; } if(tag == (int)f.size()){ return 1; } } } 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...