제출 #1086778

#제출 시각아이디문제언어결과실행 시간메모리
1086778Pacybwoah팀들 (IOI15_teams)C++17
34 / 100
4065 ms43536 KiB
#include<iostream> #include<vector> #include<algorithm> #include<utility> #include<set> #include "teams.h" using namespace std; namespace{ int n; vector<vector<int>> vec; } void init(int N, int A[], int B[]) { n = N; vec.resize(n + 1); for(int i = 0; i < n; i++) vec[A[i]].push_back(B[i]); } int can(int M, int K[]) { vector<int> vals; int m = M; for(int i = 0; i < m; i++) vals.push_back(K[i]); sort(vals.begin(), vals.end()); int ptr = 0; multiset<int> s; for(int i = 1; i <= n; i++){ for(auto &x: vec[i]) s.insert(x); while(ptr < m && vals[ptr] == i){ if((int)s.size() < i) return 0; for(int j = 0; j < i; j++) s.erase(s.begin()); ptr++; } while(!s.empty() && (*s.begin()) == i) s.erase(s.begin()); } return 1; } // g++ -std=c++17 -o run -Wshadow -Wall -Wextra -fsanitize=undefined -fsanitize=address teams.cpp grader.cpp
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...