이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
typedef long long int ll;
typedef long double ld;
#pragma GCC optimize ("Ofast")
#define double ld
const int inf = 2e9;
const int INF = 4e18;
#define F first
#define S second
#define vi vector<int>
#define vvi vector<vi>
#define pi pair<int, int>
#define vpi vector<pi>
#define vb vector<bool>
#define vvb vector<vb>
#define pb push_back
#define read(a) for(auto &x:a) cin >> x;
#define print(a) for(auto x:a) cout << x << " "; cout << "\n";
#define rs resize
#define as assign
#define vc vector<char>
#define vvc vector<vc>
#define all(x) x.begin(), x.end()
#define rall(x) x.rbegin(), x.rend()
#define ppb pop_back
#define MP make_pair
//#define int ll
const int mod = 1e9+7;
vi ask(int i);
int find_best(int n){
int ans = -1;
function<void(int, int, vi, vi)> dfs = [&](int l, int r, vi L, vi R){
if(ans != -1 || l+1 >= r || L == R) return;
int mid = (l+r)/2;
vi M = ask(mid);
if(M[0]+M[1] == 0){
ans = mid;
return;
}
if(L[0]+L[1] == R[0]+R[1] && L[0]+L[1] > M[0]+M[1] && L[1]-R[1] == 1) return;
dfs(l, mid, L, M); dfs(mid, r, M, R);
};
vi L = ask(0);
if(L[0]+L[1] == 0) return 0;
vi R = ask(n-1);
if(R[0]+R[1] == 0) return n-1;
dfs(0, n-1, L, R);
return ans;
}
// signed main(){
// ios_base::sync_with_stdio(0);
// cin.tie(0);
// #ifndef ONLINE_JUDGE
// freopen("in.txt", "r", stdin);
// freopen("out.txt", "w", stdout);
// #endif
// int k = 1;
// while(k <= 200000){
// cout << k << "\n";
// k = k*k+1;
// }
// return 0;
// }
컴파일 시 표준 에러 (stderr) 메시지
prize.cpp:9:17: warning: overflow in conversion from 'double' to 'int' changes value from '4.0e+18' to '2147483647' [-Woverflow]
9 | const int INF = 4e18;
| ^~~~
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |