제출 #783545

#제출 시각아이디문제언어결과실행 시간메모리
783545HanksburgerA Difficult(y) Choice (BOI21_books)C++17
0 / 100
1 ms304 KiB
#include "books.h" #include <bits/stdc++.h> using namespace std; vector<int> ans; void solve(int n, int k, long long a, int s) { long long x[11], y[11], l=1, r=n+1; while (l<r) { int m=(l+r)/2; if (skim(m)>=a) r=m; else l=m+1; } for (int i=1; i<=k; i++) x[i]=x[i-1]+skim(i), y[i]=y[i-1]+skim(l-i); if (l<=n) { if (x[k-1]+skim(l)<=a*2) { for (int i=1; i<k; i++) ans.push_back(i); ans.push_back(l); answer(ans); return; } } for (int i=0; i<=k; i++) { if (x[k-i]+y[i]>=a && x[k-i]+y[i]<=a*2) { for (int j=1; j<=k-i; j++) ans.push_back(j); for (int j=l-i; j<l; j++) ans.push_back(j); answer(ans); return; } } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:20:18: warning: 'x[<unknown>]' may be used uninitialized in this function [-Wmaybe-uninitialized]
   20 |         if (x[k-1]+skim(l)<=a*2)
      |             ~~~~~^
#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...