이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
#include "books.h"
using namespace std;
typedef long double ld;
typedef long long lli;
typedef vector<int32_t> vi;
typedef vector<ld> vld;
typedef vector<lli> vlli;
typedef pair<lli, lli> pii;
// #define int int64_t
#define endl "\n"
#define inp(n) lli n; cin >> n
#define inpstr(s) string s; cin >> s
#define inp2(a,b) lli a,b; cin >> a >> b
#define inparr(arr,n) lli arr[n]; f0(t_ind, n) cin >> arr[t_ind]
#define f0(i,n) for(int32_t i = 0; i < (n); i++)
#define f1(i,n) for(int32_t i = 1; i <= (n); i++)
#define testIn cin >> test
#define tests for(int32_t testNo=1; testNo <= (test); testNo++)
#define all(x) (x).begin(), (x).end()
#define rall(x) (x).rbegin(), (x).rend()
#define len(a) ((int64_t)(a).size())
#define lcm(a, b) (((a)*(b))/gcd(a,b))
#define ff first
#define ss second
#define Yes cout << "Yes" << endl
#define No cout << "No" << endl
#define YES cout << "YES" << endl
#define NO cout << "NO" << endl
#define finish return 0
#define clean fflush(stdout)
#define Inf (lli)(1e9)
#define Eps (ld)(1e-9)
#define PI (ld)(3.141592653589793238462643383279502884197169L)
#define MOD (int32_t)(1e9+7)
//
// --- 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 solve(int N, int K, long long A, int S) {
// TODO implement this function
vi books;
f0(i, N) {
books.push_back(skim(i));
}
f1(mid, N-2) {
int32_t i = 0, j = N-1;
while(i < mid && mid < j) {
if(books[i] + books[mid] + books[j] > 2*A) {
j--;
} else if(books[i] + books[mid] + books[j] < A) {
i++;
} else {
answer({i, j, mid});
return;
}
}
}
}
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |