제출 #735677

#제출 시각아이디문제언어결과실행 시간메모리
735677Charizard2021A Difficult(y) Choice (BOI21_books)C++17
25 / 100
2 ms292 KiB
#include "books.h" #include<bits/stdc++.h> using namespace std; vector<long long> seq; bool IsInRange(long long A, long long Sum){ return Sum >= A && Sum <= 2 * A; } void solve(int N, int K, long long A, int S){ long long low = (long long)0; long long high = (long long)N; high++; while(low + 1 < high){ long long mid = (low + high)/2; if(skim(mid) > A){ high = mid; } else{ low = mid; } } long long GreaterVal = high; if(GreaterVal < K){ impossible(); } vector<long long> minimum; long long SumMinimum = 0; for(long long i = 1; i <= K; i++){ minimum.push_back(skim(i)); SumMinimum += minimum[i - 1]; } if(GreaterVal <= N){ long long first_large_val = skim(GreaterVal); if(IsInRange(A, SumMinimum + first_large_val)){ vector<int> ans(K, GreaterVal); for(int i = 0; i < ans.size() - 1; i++){ ans[i] = i + 1; } answer(ans); } } if(GreaterVal <= K){ impossible(); } if(SumMinimum > 2 * A){ impossible(); } vector<long long> Inbetween; long long SumInBetween = 0; for(long long i = GreaterVal - K; i < GreaterVal; ++i){ Inbetween.push_back(skim(i)); SumInBetween += skim(i); } if(SumInBetween < A){ impossible(); } vector<int> ans(K); for(long long i = 0; i < ans.size(); i++){ ans[i] = i + 1; } for(long long i = K - 1; ; i--){ if(IsInRange(A, SumMinimum)){ answer(ans); } SumMinimum -= minimum[i]; SumMinimum += Inbetween[i]; ans[i] = GreaterVal - K + i; } }

컴파일 시 표준 에러 (stderr) 메시지

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:35:30: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   35 |             for(int i = 0; i < ans.size() - 1; i++){
      |                            ~~^~~~~~~~~~~~~~~~
books.cpp:57:28: warning: comparison of integer expressions of different signedness: 'long long int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   57 |     for(long long i = 0; i < ans.size(); i++){
      |                          ~~^~~~~~~~~~~~
#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...