Submission #780624

#TimeUsernameProblemLanguageResultExecution timeMemory
780624caganyanmazTeams (IOI15_teams)C++17
34 / 100
4066 ms8908 KiB
#include <bits/stdc++.h> #define pb push_back using namespace std; #define mp(x...) array<int, 2>({x}) #include "teams.h" constexpr static int DEBUG_SIZE = 10; void __print(const char* s) { cerr << s; } void __print(string s) { cerr << s; } void __print(int* i) { cerr << "{"; cerr << i[0]; for (int j = 1; j < DEBUG_SIZE; j++) cerr << ", " << i[j]; cerr << "}"; } void __print(int i) { cerr << i; } template<typename T> void __print(T& t) {cerr <<"{";int f = 0; for (auto& i : t) { cerr << ((f++) ? ", ": ""); __print(i); } cerr <<"}";} void _print() { cerr << "]\n"; } template<typename T, typename... V> void _print(T t, V... v) { __print(t); if(sizeof...(v)) cerr << ", "; _print(v...); } //#define DEBUGGING #ifdef DEBUGGING #define debug(x...) cerr << "[" << (#x) << "] = ["; _print(x) #else #define debug(x...) #endif constexpr static int MXSIZE = 500000; int n; array<int, 2> intervals[MXSIZE]; void init(int N, int A[], int B[]) { n = N; for (int i = 0; i < n; i++) intervals[i] = mp(B[i], A[i]); sort(intervals, intervals + n); } bitset<MXSIZE> used; int can(int m, int k[]) { sort(k, k+m); used.reset(); for (int i = 0; i < m; i++) { int val = k[i]; int cnt = 0; for (int j = 0; j < n && cnt < k[i]; j++) { if (used[j] || intervals[j][0] < k[i] || intervals[j][1] > k[i]) continue; used[j] = true; cnt++; } if (cnt != k[i]) return 0; } return 1; }

Compilation message (stderr)

teams.cpp: In function 'int can(int, int*)':
teams.cpp:47:21: warning: unused variable 'val' [-Wunused-variable]
   47 |                 int val = k[i];
      |                     ^~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...