Submission #578711

#TimeUsernameProblemLanguageResultExecution timeMemory
578711georgievskiyTeams (IOI15_teams)C++14
0 / 100
4037 ms26188 KiB
#include "teams.h" #include <bits/stdc++.h> using namespace std; const int N = 2e5; int a[N], b[N]; int n; void init(int N, int A[], int B[]) { n = N; vector<pair<int, int>> t(n); for (int i = 0; i < n; i++) t[i] = {B[i], A[i]}; sort(t.begin(), t.end()); for (int i = 0; i < n; i++) a[i] = t[i].second, b[i] = t[i].first; } int can(int m, int k[]) { sort(k, k + m); int p = 0; for (int i = 0; i < m; i++) { int x = k[i]; while (k[i]) { if (a[p] <= x && x <= b[p]) k[i]--; p++; if (p == n && !(k[i] == 0 && i == m - 1)) return 0; } } return 1; }

Compilation message (stderr)

teams.cpp: In function 'void init(int, int*, int*)':
teams.cpp:9:15: warning: declaration of 'N' shadows a global declaration [-Wshadow]
    9 | void init(int N, int A[], int B[]) {
      |           ~~~~^
teams.cpp:5:11: note: shadowed declaration is here
    5 | const int N = 2e5;
      |           ^
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...