Submission #944055

#TimeUsernameProblemLanguageResultExecution timeMemory
944055thelegendary08A Difficult(y) Choice (BOI21_books)C++17
5 / 100
109 ms1228 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) { vector<long long int>v(N); for(int i = 1;i<=N;i++){ v[i-1] = skim(i); } for(int i = 0;i<N-2;i++){ for(int j = i+1;j<N-1;j++){ int l = j+1; int r = N-1; while(l <= r){ ll k = (l+r)/2; if(v[i] + v[j] + v[k] <= 2*A && v[i] + v[j] + v[k] >= A){ answer({i+1, j+1, k+1}); } if(v[i] + v[j] + v[k] > 2*A)r = k-1; else l = k+1; } } } impossible(); }

Compilation message (stderr)

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:29:40: warning: narrowing conversion of '(k + 1)' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
   29 |                     answer({i+1, j+1, k+1});
      |                                       ~^~
books.cpp:29:40: warning: narrowing conversion of '(k + 1)' from 'll' {aka 'long long int'} to 'int' [-Wnarrowing]
#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...