Submission #971850

#TimeUsernameProblemLanguageResultExecution timeMemory
971850VinhLuuTeams (IOI15_teams)C++17
Compilation error
0 ms0 KiB
//#pragma GCC optimize("O3,unroll-loops") //#pragma GCC target("avx2,bmi,bmi2,lzcnt,popcnt") #include <bits/stdc++.h> #define ll long long #define fi first #define se second #define pb push_back #define all(lmao) lmao.begin(), lmao.end() using namespace std; typedef pair<int,int> pii; typedef tuple<int,int,int> tp; const int N = 1e6 + 5; int block = 555; const int mod = 1e9 + 7; //const ll oo = 5e18; int n; vector<pii> vr; void init(int _n, vector<int> A, vector<int> B){ n = _n; for(int i = 0; i < n; i ++){ vr.pb({A[i], B[i]}); } sort(all(vr), [&](pii x,pii y){return x.fi < y.fi;}); } int can(int m,vector<int> K){ int ptr = -1; sort(all(K)); bool ff = true; priority_queue<int,vector<int>, greater<int>> pq; for(auto j : K){ while(ptr + 1 < vr.size() && vr[ptr + 1].fi <= j) pq.push(vr[ptr + 1].se), ptr++; int u = j; while(u){ if(pq.empty()) return 0; if(pq.top() >= j) u--; pq.pop(); } } return 1; } //#define lpv #ifdef lpv int n_; vector<int> a_, b_; int inQ; int inM; vector<int> inK; signed main(){ ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0); #define task "v" if(fopen(task ".inp","r")){ freopen(task ".inp","r",stdin); freopen(task ".out","w",stdout); } cin >> n_ >> inQ; for (int i = 0; i < n_; ++i){ int x, y; cin >> x >> y; a_.pb(x); b_.pb(y); } init(n_, a_, b_); while (inQ--) { cin >> inM; for (int i = 0; i < inM; ++i){ int x; cin >> x; inK.pb(x); } cout << can(inM, inK) << "\n"; } } #endif // lpv

Compilation message (stderr)

teams.cpp: In function 'int can(int, std::vector<int>)':
teams.cpp:37:23: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<std::pair<int, int> >::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   37 |         while(ptr + 1 < vr.size() && vr[ptr + 1].fi <= j) pq.push(vr[ptr + 1].se), ptr++;
      |               ~~~~~~~~^~~~~~~~~~~
teams.cpp:34:10: warning: unused variable 'ff' [-Wunused-variable]
   34 |     bool ff = true;
      |          ^~
teams.cpp:31:13: warning: unused parameter 'm' [-Wunused-parameter]
   31 | int can(int m,vector<int> K){
      |         ~~~~^
/usr/bin/ld: /tmp/cc2sSPAW.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