제출 #741629

#제출 시각아이디문제언어결과실행 시간메모리
741629MODDI팀들 (IOI15_teams)C++14
0 / 100
128 ms23088 KiB
#include "teams.h" //#include "grader.cpp" #include <bits/stdc++.h> #define ll long long #define mp make_pair #define pb push_back #define pii pair<int,int> using namespace std; vector<pii> arr; bool comp(pii& a, pii& b){ if(a.first < b.first) return true; else if(a.first > b.first) return false; else{ if(b.first < a.first) return false; return true; } } void init(int N, int A[], int B[]) { for(int i = 0; i < N; i++){ arr.pb(mp(A[i], B[i])); } sort(arr.begin(), arr.end(), comp); } int can(int M, int K[]) { vector<int> teams; for(int i = 0; i < M; i++) teams.pb(K[i]); sort(teams.begin(), teams.end()); int j = 0; for(int i = 0; i < teams.size(); j++){ int in = 0; while(in < teams[i]){ if(arr[j].second < teams[i]){ j++; if(j == arr.size()) return 0; } else if(arr[j].first <= teams[i]){ in++; j++; if(j == arr.size() && in < teams[i]) return 0; } else if(arr[j].first > teams[i]){ return 0; } } } return 1; }

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

teams.cpp: In function 'int can(int, int*)':
teams.cpp:31:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   31 |  for(int i = 0; i < teams.size(); j++){
      |                 ~~^~~~~~~~~~~~~~
teams.cpp:36:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   36 |     if(j == arr.size()) return 0;
      |        ~~^~~~~~~~~~~~~
teams.cpp:41:10: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   41 |     if(j == arr.size() && in < teams[i]) 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...