Submission #1017853

#TimeUsernameProblemLanguageResultExecution timeMemory
1017853vivkostovHoliday (IOI14_holiday)C++14
Compilation error
0 ms0 KiB
#include<bits/stdc++.h> //#define endl '\n' using namespace std; void speed() { ios_base::sync_with_stdio(false); cin.tie(NULL); cout.tie(NULL); } struct cell { long long nt st; bool operator<(const cell&a)const { return st>a.st; } }; priority_queue<cell>q; long long int n,a[3005],k,st,sum; void fil(int h) { cell g; for(int i=h;i<=st;i++) { sum+=a[i]; g.st=a[i]; q.push(g); } } void read() { cin>>n>>k>>st; cell h; for(int i=1;i<=n;i++) { cin>>a[i]; } long long int p=k,otg=0; for(int i=1;i<=st;i++) { for(int j=st;j<=n;j++) { p-=min(st-i,j-st); p-=j-i; if(p<=0)break; if(j==st) { fil(i); } else { sum+=a[j]; h.st=a[j]; q.push(h); } while(p<q.size()) { //cout<<q.top().st<<" "<<i<<" "<<j<<" "<<q.size()<<endl; sum-=q.top().st; q.pop(); } p=k; otg=max(otg,sum); } sum=0; while(!q.empty())q.pop(); } cout<<otg<<endl; } long long int findMaxAttraction(int N, int start, int d, int attraction[]) { n=N; st=start; k=d; cell h; for(int i=1;i<=n;i++) { a[i]=attraction[i-1]; } long long int p=k,otg=0; for(int i=1;i<=st;i++) { for(int j=st;j<=n;j++) { p-=min(st-i,j-st); p-=j-i; if(p<=0)break; if(j==st) { fil(i); } else { sum+=a[j]; h.st=a[j]; q.push(h); } while(p<q.size()) { sum-=q.top().st; q.pop(); } p=k; otg=max(otg,sum); } sum=0; while(!q.empty())q.pop(); } return otg; } /*int main() { speed(); read(); return 0; } */

Compilation message (stderr)

holiday.cpp:12:15: error: expected ';' at end of member declaration
   12 |     long long nt st;
      |               ^~
      |                 ;
holiday.cpp:12:18: error: 'st' does not name a type; did you mean 'std'?
   12 |     long long nt st;
      |                  ^~
      |                  std
holiday.cpp: In member function 'bool cell::operator<(const cell&) const':
holiday.cpp:15:16: error: 'st' was not declared in this scope; did you mean 'nt'?
   15 |         return st>a.st;
      |                ^~
      |                nt
holiday.cpp:15:21: error: 'const struct cell' has no member named 'st'; did you mean 'nt'?
   15 |         return st>a.st;
      |                     ^~
      |                     nt
holiday.cpp: In function 'void fil(int)':
holiday.cpp:26:11: error: 'struct cell' has no member named 'st'; did you mean 'nt'?
   26 |         g.st=a[i];
      |           ^~
      |           nt
holiday.cpp: In function 'void read()':
holiday.cpp:53:19: error: 'struct cell' has no member named 'st'; did you mean 'nt'?
   53 |                 h.st=a[j];
      |                   ^~
      |                   nt
holiday.cpp:56:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::priority_queue<cell>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   56 |             while(p<q.size())
      |                   ~^~~~~~~~~
holiday.cpp:59:30: error: 'const value_type' {aka 'const struct cell'} has no member named 'st'; did you mean 'nt'?
   59 |                 sum-=q.top().st;
      |                              ^~
      |                              nt
holiday.cpp: In function 'long long int findMaxAttraction(int, int, int, int*)':
holiday.cpp:95:19: error: 'struct cell' has no member named 'st'; did you mean 'nt'?
   95 |                 h.st=a[j];
      |                   ^~
      |                   nt
holiday.cpp:98:20: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::priority_queue<cell>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   98 |             while(p<q.size())
      |                   ~^~~~~~~~~
holiday.cpp:100:30: error: 'const value_type' {aka 'const struct cell'} has no member named 'st'; did you mean 'nt'?
  100 |                 sum-=q.top().st;
      |                              ^~
      |                              nt