제출 #574959

#제출 시각아이디문제언어결과실행 시간메모리
574959birthdaycakeA Difficult(y) Choice (BOI21_books)C++17
0 / 100
16 ms336 KiB
#include <bits/stdc++.h> #include "books.h" using namespace std; long long b[200001]; void solve(int n, int k, long long a, int s) { set<long long>v; long long a1 = 0, a2 = 0, a3 = -1; for(int i = 0; i < n; i++) { b[i] = skim(i + 1); v.insert(b[i]); } for(int i = 0; i < n; i++){ for(int j = i + 1; j < n; j++){ int tot = a - (b[i] + b[j]) - 1; auto x = v.upper_bound(tot); if(*x == b[i]) x = v.upper_bound(*x); if(*x == b[j]) x = v.upper_bound(*x); if(x != v.end()){ if(*x + b[i] + b[j] <= a * 2 && *x + b[i] + b[j] >= a ){ a1 = i; a2 = j; a3 = *x; } } } } for(int i = 0; i < n; i++){ if(a3 == b[i]){ vector<int>fin = {i + 1, a1 + 1, a2 + 1}; answer(fin); } } impossible(); }

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

books.cpp: In function 'void solve(int, int, long long int, int)':
books.cpp:34:41: warning: narrowing conversion of '(a1 + 1)' from 'long long int' to 'int' [-Wnarrowing]
   34 |             vector<int>fin = {i + 1, a1 + 1, a2 + 1};
      |                                      ~~~^~~
books.cpp:34:41: warning: narrowing conversion of '(a1 + 1)' from 'long long int' to 'int' [-Wnarrowing]
books.cpp:34:49: warning: narrowing conversion of '(a2 + 1)' from 'long long int' to 'int' [-Wnarrowing]
   34 |             vector<int>fin = {i + 1, a1 + 1, a2 + 1};
      |                                              ~~~^~~
books.cpp:34:49: warning: narrowing conversion of '(a2 + 1)' from '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...