Submission #268395

#TimeUsernameProblemLanguageResultExecution timeMemory
268395A02Teams (IOI15_teams)C++14
0 / 100
4077 ms16480 KiB
#include "teams.h" #include <vector> #include <set> #include <algorithm> #include <utility> #include <queue> #include <iostream> using namespace std; vector<pair<int, int> > intervals; void init(int N, int A[], int B[]) { for (int i = 0; i < N; i++){ intervals.push_back(make_pair(B[i], A[i])); } sort(intervals.begin(), intervals.end()); } int can(int M, int K[]) { vector<long long> projects; for (int i = 0; i < M; i++){ projects.push_back(K[i]); } sort(projects.begin(), projects.end()); vector<bool> used (intervals.size(), false); int c_student = 0; for (int i = 0; i < M; i++){ int to_fill = K[i]; for (int j = 0; j < intervals.size(); j++){ if (intervals[j].first >= K[i] && intervals[j].second <= K[i] && to_fill > 0 && !used[j]> 0){ to_fill--; //cout << intervals[j].first << ' ' << intervals[j].second << endl; used[j] = true; } } if (to_fill != 0){ //cout << 0 << endl; return 0; } } //cout << 1 << endl; return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:39:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   39 |         for (int j = 0; j < intervals.size(); j++){
      |                         ~~^~~~~~~~~~~~~~~~~~
teams.cpp:34:9: warning: unused variable 'c_student' [-Wunused-variable]
   34 |     int c_student = 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...