제출 #1172538

#제출 시각아이디문제언어결과실행 시간메모리
1172538perchutsA Difficult(y) Choice (BOI21_books)C++20
20 / 100
68 ms576 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; // // --- 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 SequalsN(int n, int k, long long a, int s) { #define int long long vector<int> v(n); for (int i = 0; i < n; ++i) v[i] = skim(i+1); int lim = 0, cur = 0; set<int> ans; while (lim+1 < n and v[lim+1] <= a) lim++; for (int i = 0; i < k; ++i) ans.insert(i+1), cur += v[i]; auto go = [&] () { vector<int32_t> resp; for (auto x : ans) resp.push_back(x); answer(resp); }; if (a <= cur and cur <= 2*a) go(); for (int i = k; i < n; ++i) { int x = cur - v[k-1] + v[i]; if (a <= x and x <= 2*a) { ans.erase(k); ans.insert(i+1); go(); } } if (lim < k) impossible(); for (int i = k-1; ~i; --i) { for (int j = i+1; j <= lim-(k-1-i); ++j) { cur += v[j] - v[j-1]; ans.insert(j+1); ans.erase(j); if (a <= cur) go(); } } impossible(); #define int int } void solve(int n, int k, long long a, int s) { s = min(s, n); if (s == n) SequalsN(n, k, a, s); assert(false); }

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

books.cpp:47: warning: "int" redefined
   47 | #define int int
      | 
books.cpp:16: note: this is the location of the previous definition
   16 | #define int long long
      |
#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...