Submission #369635

#TimeUsernameProblemLanguageResultExecution timeMemory
369635Bill_00Jakarta Skyscrapers (APIO15_skyscraper)C++14
Compilation error
0 ms0 KiB
#include <bits/stdc++.h> #define ff first #define ss second #define mp make_pair #define pb push_back #define pp push #define MOD 1000000007 #define INF 1e18 #define N 30005 #define M 5000000 const ll c=174; typedef long long ll; using namespace std; ll b[N],p[N],pos[N],path[N]; bool vis[N]; set<ll>v[c][c]; int main(){ // ios_base::sync_with_stdio(0); // cin.tie(0); // cout.tie(0) memset(pos,-1,sizeof(pos)); memset(path,-1,sizeof(path)); ll n,m; cin >> n >> m; for(ll i=0;i<m;i++){ cin >> b[i] >> p[i]; pos[b[i]]=i; for(ll j=1;j<c;j++){ v[j][b[i]%j].insert(i); } } priority_queue<pair<ll,ll> >pq; pq.push({0,0}); while(!pq.empty()){ ll cost=-pq.top().ff; ll doge_id=pq.top().ss; path[doge_id]=cost; pq.pop(); vis[doge_id]=1; if(p[doge_id]>=c){ for(ll i=b[doge_id]%p[doge_id];i<n;i+=p[doge_id]){ if(pos[i]!=-1){ if(vis[pos[i]]==0){ pq.push({-(cost+(abs(b[doge_id]-i))/p[doge_id]),pos[i]}); } } } } else{ for(ll i=1;i<c;i++){ v[i][b[doge_id]%i].erase(doge_id); } for(auto it=v[p[doge_id]][b[doge_id]%p[doge_id]].begin();it!=v[p[doge_id]][b[doge_id]%p[doge_id]].end();++it){ if(vis[*it]==0){ pq.push({-(cost+(abs(b[*it]-b[doge_id]))/p[doge_id]),*it}); } } } while(!pq.empty() && vis[pq.top().ss]==1) pq.pop(); } cout << path[1]; }

Compilation message (stderr)

skyscraper.cpp:11:7: error: 'll' does not name a type
   11 | const ll c=174;
      |       ^~
skyscraper.cpp:16:10: error: 'c' was not declared in this scope
   16 | set<ll>v[c][c];
      |          ^
skyscraper.cpp:16:13: error: 'c' was not declared in this scope
   16 | set<ll>v[c][c];
      |             ^
skyscraper.cpp: In function 'int main()':
skyscraper.cpp:28:17: error: 'c' was not declared in this scope
   28 |    for(ll j=1;j<c;j++){
      |                 ^
skyscraper.cpp:29:5: error: 'v' was not declared in this scope
   29 |     v[j][b[i]%j].insert(i);
      |     ^
skyscraper.cpp:40:19: error: 'c' was not declared in this scope
   40 |    if(p[doge_id]>=c){
      |                   ^
skyscraper.cpp:51:6: error: 'v' was not declared in this scope
   51 |      v[i][b[doge_id]%i].erase(doge_id);
      |      ^
skyscraper.cpp:53:17: error: 'v' was not declared in this scope
   53 |     for(auto it=v[p[doge_id]][b[doge_id]%p[doge_id]].begin();it!=v[p[doge_id]][b[doge_id]%p[doge_id]].end();++it){
      |                 ^
skyscraper.cpp:55:64: error: no matching function for call to 'std::priority_queue<std::pair<long long int, long long int> >::push(<brace-enclosed initializer list>)'
   55 |       pq.push({-(cost+(abs(b[*it]-b[doge_id]))/p[doge_id]),*it});
      |                                                                ^
In file included from /usr/include/c++/9/queue:64,
                 from /usr/include/x86_64-linux-gnu/c++/9/bits/stdc++.h:86,
                 from skyscraper.cpp:1:
/usr/include/c++/9/bits/stl_queue.h:627:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(const value_type&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; _Compare = std::less<std::pair<long long int, long long int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long int, long long int>]'
  627 |       push(const value_type& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:627:30: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'const value_type&' {aka 'const std::pair<long long int, long long int>&'}
  627 |       push(const value_type& __x)
      |            ~~~~~~~~~~~~~~~~~~^~~
/usr/include/c++/9/bits/stl_queue.h:635:7: note: candidate: 'void std::priority_queue<_Tp, _Sequence, _Compare>::push(std::priority_queue<_Tp, _Sequence, _Compare>::value_type&&) [with _Tp = std::pair<long long int, long long int>; _Sequence = std::vector<std::pair<long long int, long long int>, std::allocator<std::pair<long long int, long long int> > >; _Compare = std::less<std::pair<long long int, long long int> >; std::priority_queue<_Tp, _Sequence, _Compare>::value_type = std::pair<long long int, long long int>]'
  635 |       push(value_type&& __x)
      |       ^~~~
/usr/include/c++/9/bits/stl_queue.h:635:25: note:   no known conversion for argument 1 from '<brace-enclosed initializer list>' to 'std::priority_queue<std::pair<long long int, long long int> >::value_type&&' {aka 'std::pair<long long int, long long int>&&'}
  635 |       push(value_type&& __x)
      |            ~~~~~~~~~~~~~^~~