제출 #619433

#제출 시각아이디문제언어결과실행 시간메모리
619433A_D팀들 (IOI15_teams)C++14
34 / 100
4030 ms17796 KiB
#include "teams.h" #include<bits/stdc++.h> using namespace std; const int N=1e5+100; int n; vector<pair<int,int>> vec[N]; vector<pair<int,int>> vec2[N]; void init(int N, int A[], int B[]) { n=N; for(int i=0;i<=n;i++){ vec[i].clear(); vec2[i].clear(); } for(int i=0;i<n;i++){ vec[A[i]].push_back({B[i],i}); vec2[B[i]].push_back({B[i],i}); } } int can(int M, int K[]) { set<pair<int,int>> st; sort(K,K+M); int j=0; for(int i=1;i<=n;i++){ for(auto x:vec[i]){ st.insert(x); } if(j==M)break; while(j!=M&&K[j]==i){ if(st.size()<K[j]){ return 0; } int h=K[j]; while(h--){ st.erase(*st.begin()); } j++; } for(auto x:vec2[i]){ if(st.find(x)!=st.end()){ st.erase(x); } } } if(j==M)return 1; else return 0; }

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

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:8:15: warning: declaration of 'N' shadows a global declaration [-Wshadow]
    8 | void init(int N, int A[], int B[]) {
      |           ~~~~^
teams.cpp:4:11: note: shadowed declaration is here
    4 | const int N=1e5+100;
      |           ^
teams.cpp: In function 'int can(int, int*)':
teams.cpp:35:25: warning: comparison of integer expressions of different signedness: 'std::set<std::pair<int, int> >::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   35 |             if(st.size()<K[j]){
      |                ~~~~~~~~~^~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...