Submission #863665

#TimeUsernameProblemLanguageResultExecution timeMemory
863665Ahmed_SolymanA Difficult(y) Choice (BOI21_books)C++14
0 / 100
1 ms600 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; typedef long long ll; // // --- Sample implementation for the task books --- // // To compile this program with the sample grader, place: // books.h books_sample.cpp sample_grader.cpp // in a single folder and run: // g++ books_sample.cpp sample_grader.cpp // in this folder. // void solve(int n, int k, long long a, int s) { // TODO implement this function ll sum=0; vector<int>v; for(int i=1;i<k;i++)sum+=skim(i),v.push_back(i); vector<int>dp(n,-1); int l=k,r=n; while(l<=r){ int mid=l+r>>1; ll s=sum; if(~dp[mid])sum+=dp[mid]; else sum+=dp[mid]=skim(mid); if(s<a){ l=mid+1; } else if(s>a*2){ r=mid-1; } else{ v.push_back(mid); answer(v); } } l=1;r=n-k+1; while(l<=r){ int mid=l+r>>1; ll S=0; vector<int>v; for(int i=mid;i<mid+k;i++){ v.push_back(i); if(~dp[i])sum+=dp[i]; else sum+=dp[i]=skim(i); } if(S<a){ l=mid+1; } else if(S>a*2){ r=mid-1; } else{ answer(v); } } impossible(); }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:25:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   25 |         int mid=l+r>>1;
      |                 ~^~
books.cpp:42:18: warning: suggest parentheses around '+' inside '>>' [-Wparentheses]
   42 |         int mid=l+r>>1;
      |                 ~^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...