이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include "prize.h"
#include <algorithm>
#include <string.h>
#include <iostream>
#include <stdio.h>
#include <vector>
#include <queue>
#include <cmath>
#include <set>
#include <map>
using namespace std;
#define N 200010
#define ff first
#define ss second
#define ll long long
#define pb push_back
#define mod 1000000007
#define pii pair <int, int>
#define sz(a) int(a.size())
#pragma GCC target ("avx2")
#pragma GCC optimization ("O3")
#pragma GCC optimization ("unroll-loops")
ll bigmod(ll a,ll e) {if(e==0)return 1;ll x=bigmod(a*a%mod,e>>1);return e&1?x*a%mod:x;}
pii p[N];
queue <pii> Q;
int find_best(int n)
{
for(int i = 0; i < n; i++) p[i] = {-1, -1};
Q.push({0, n-1});
while(!Q.empty()) {
int l = Q.front().ff, r = Q.front().ss;
Q.pop();
if(p[l].ff == -1 && p[l].ss == -1) {
vector <int> cur = ask(l);
p[l] = {cur[0], cur[1]};
}
if(p[r].ff == -1 && p[r].ss == -1) {
vector <int> cur = ask(r);
p[r] = {cur[0], cur[1]};
}
if(p[l].ff == 0 && p[l].ss == 0) return l;
if(p[r].ff == 0 && p[r].ss == 0) return r;
if(p[l].ss == p[r].ss || p[r].ff == p[l].ff) continue;
int md = (l+r)/2;
Q.push({l, md});
Q.push({md, r});
}
}
컴파일 시 표준 에러 (stderr) 메시지
prize.cpp:23: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
23 | #pragma GCC optimization ("O3")
|
prize.cpp:24: warning: ignoring #pragma GCC optimization [-Wunknown-pragmas]
24 | #pragma GCC optimization ("unroll-loops")
|
prize.cpp: In function 'int find_best(int)':
prize.cpp:59:1: warning: control reaches end of non-void function [-Wreturn-type]
59 | }
| ^
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |