Submission #299013

#TimeUsernameProblemLanguageResultExecution timeMemory
299013BatyrThe Big Prize (IOI17_prize)C++17
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #include "prize.h" using namespace std; #define pb push_back #define ss second #define ff first #define pii pair<int,int> const int maxn=2e5+5; int dp[maxn][3],ans; queue<pii>q; int find_best(int n){ memset(dp,-1,sizeof(dp)); q.push({0,n-1}); while(!q.empty()){ int l=q.top().ff; int r=q.top().ss; q.pop(); if(dp[l][0]==-1 and dp[l][1]==-1){ vector<int> p=ask(l); dp[l][0]=p[0]; dp[l][1]=p[1]; } if(dp[l][0]+dp[l][1] == 0) return l; if(dp[r][0]==-1 and dp[r][1] == -1){ vector<int> p=ask(r); dp[r][0]=p[0]; dp[r][1]=p[1]; } if(dp[r][0]+dp[r][1] == 0) return r; if(dp[l][0]+dp[l][1]==dp[r][0]+dp[r][1] and dp[r][0]-dp[l][0] == 0) continue; q.push({l,(l+r)/2}); q.push({(l+r)/2+1,r}); } }

Compilation message (stderr)

prize.cpp: In function 'int find_best(int)':
prize.cpp:17:11: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'?
   17 |   int l=q.top().ff;
      |           ^~~
      |           pop
prize.cpp:18:11: error: 'class std::queue<std::pair<int, int> >' has no member named 'top'; did you mean 'pop'?
   18 |   int r=q.top().ss;
      |           ^~~
      |           pop
prize.cpp:36:1: warning: control reaches end of non-void function [-Wreturn-type]
   36 | }
      | ^