Submission #756589

#TimeUsernameProblemLanguageResultExecution timeMemory
756589minhcoolTeams (IOI15_teams)C++17
Compilation error
0 ms0 KiB
//#define local #ifndef local #include "teams.h" #endif #include<bits/stdc++.h> #include <ext/pb_ds/assoc_container.hpp> using namespace __gnu_pbds; using namespace std; #define int long long #define fi first #define se second #define pb push_back #define mp make_pair typedef pair<int, int> ii; typedef pair<ii, int> iii; typedef pair<ii, ii> iiii; const int N = 3e5 + 5; const int oo = 1e18 + 7, mod = 1e9 + 7; mt19937 rng(1); int rnd(int l, int r){ int temp = rng() % (r - l + 1); return abs(temp) + l; } int n; ii range[N]; void init(int N, int A[], int B[]){ n = N; for(int i = 1; i <= n; i++) range[i] = {A[i - 1], B[i - 1]}; sort(range + 1, range + n + 1); } int can(int m, int k[]){ sort(k, k + m); int itr = 1; priority_queue<ii, vector<ii>, greater<ii>> pq; for(int i = 0; i < m; i++){ while(itr <= n && range[itr].fi <= k[i]){ pq.push({range[itr].se, itr}); itr++; } //cout << i << " " << itr << "\n"; for(int j = 0; j < k[i]; j++){ if(pq.empty()) return 0; // cout << pq.top().fi << "\n"; if(pq.top().fi < k[i]) return 0; pq.pop(); } } if(itr <= n || !pq.empty()) return 0; return 1; } //#define local #ifdef local void process(){ int n; cin >> n; int a[n], b[n]; for(int i = 0; i < n; i++) cin >> a[i] >> b[i]; init(n, a, b); int q; cin >> q; while(q--){ int m; cin >> m; int k[m]; for(int i = 0; i < m; i++) cin >> k[i]; cout << can(m, k) << "\n"; } } signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); int t = 1; //cin >> t; while(t--) process(); } #endif

Compilation message (stderr)

teams.cpp: In function 'void init(long long int, long long int*, long long int*)':
teams.cpp:34:15: warning: declaration of 'N' shadows a global declaration [-Wshadow]
   34 | void init(int N, int A[], int B[]){
      |               ^
teams.cpp:20:11: note: shadowed declaration is here
   20 | const int N = 3e5 + 5;
      |           ^
/usr/bin/ld: /tmp/ccnz4Lqg.o: in function `main':
grader.c:(.text.startup+0x88): undefined reference to `init(int, int*, int*)'
/usr/bin/ld: grader.c:(.text.startup+0x242): undefined reference to `can(int, int*)'
collect2: error: ld returned 1 exit status