답안 #297099

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
297099 2020-09-11T08:47:36 Z Muhammetali 커다란 상품 (IOI17_prize) C++11
20 / 100
1 ms 512 KB
#include "prize.h"
#include <bits/stdc++.h>
#define mp make_pair
#define f first
#define s second
#define sz(x) (int)(x).size()
#define rsz resize
#define ins insert
#define ft front()
#define bk back()
#define pf push_front
#define pb push_back
#define eb emplace_back
#define lb lower_bound
#define ub upper_bound
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int,int> pi;
typedef pair<ll,ll> pl;
typedef vector<int> vi;
typedef vector<bool> vb;
typedef vector<ll> vl;
typedef vector<pi> vpi;
typedef vector<pl> vpl;
int find_best(int n)
{
	queue<pi>q;
	q.push({0,n-1});
	while(sz(q))
	{
		int l=q.ft.f;
		int r=q.ft.s;
		q.pop();
		int mid=(l+r)/2;
		vi res=ask(mid);
		if (res[0]==0 && res[1]==0)return mid;
		if (res[0]==1 && l<r)q.push({l,mid});
		if (res[1]==1 && l<r)q.push({mid+1,r});
	}
}

Compilation message

prize.cpp: In function 'int find_best(int)':
prize.cpp:28:11: warning: control reaches end of non-void function [-Wreturn-type]
   28 |  queue<pi>q;
      |           ^
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 384 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 256 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 1 ms 256 KB Output is correct
2 Correct 1 ms 256 KB Output is correct
3 Correct 1 ms 256 KB Output is correct
4 Correct 1 ms 256 KB Output is correct
5 Correct 1 ms 288 KB Output is correct
6 Correct 1 ms 256 KB Output is correct
7 Correct 1 ms 288 KB Output is correct
8 Correct 1 ms 256 KB Output is correct
9 Correct 1 ms 256 KB Output is correct
10 Correct 1 ms 256 KB Output is correct
11 Runtime error 1 ms 512 KB Execution killed with signal 11 (could be triggered by violating memory limits)
12 Halted 0 ms 0 KB -