제출 #1032324

#제출 시각아이디문제언어결과실행 시간메모리
1032324Marco_EscandonA Difficult(y) Choice (BOI21_books)C++14
5 / 100
121 ms1112 KiB
#include<bits/stdc++.h> using namespace std; typedef long long ll; const string ny[2] = {"No", "Yes"}; #include"books.h" void solve(int n, int k, long long a, int S) { ll cad[n+4]={ }; ll v[k+2]={ },ac=0; v[k]=n+3; for(int i=1; i<=n; i++) { cad[i]=skim(i); if(i<=k) { v[i-1]=i; ac+=cad[i]; } } /*for(int i=k-1; i>-1; i--) { ll temp=ac-cad[v[i]]+cad[v[i]+1]; while(temp<2*a&&ac<a&&v[i]<v[i+1]-1&&v[i]<n) { ac-=cad[v[i]]; v[i]++; ac+=cad[v[i]]; temp=ac-cad[v[i]]+cad[v[i]+1]; } }*/ for(int i=0; i<n; i++) { for(int j=i+1; j<n; j++) { for(int l=j+1; l<n; l++) { if(cad[i+1]+cad[j+1]+cad[l+1]>=a&&cad[i+1]+cad[j+1]+cad[l+1]<=2*a) { answer({i+1,j+1,l+1}); return; } } } } if(ac<a||ac>2*a) impossible(); vector<int> ans; for(int i=0; i<k; i++) ans.push_back(v[i]); answer(ans); }
#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...