답안 #541468

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
541468 2022-03-23T16:27:15 Z AmirElarbi 최후의 만찬 (IOI12_supper) C++14
컴파일 오류
0 ms 0 KB
#include <bits/stdc++.h>
#define vi vector<int>
#define ve vector
#define ll long long
#define vf vector<float>
#define vll vector<pair<ll,ll>>
#define ii pair<int,int>
#define pll pair<ll,ll>
#define vvi vector<vi>
#define vii vector<ii>
#define gii greater<ii>
#define pb push_back
#define mp make_pair
#define fi first
#define se second
#define INF 2e9+5
#define eps 1e-7
#define eps1 1e-25
#define optimise ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define MAX_A 1e5+5
#define V 450
using namespace std;
const int MOD = 1e9;
const int nax = 1e5+5;
int st[nax*4];
vii rngs;
void update(int v, int l, int r, int pos, int val){
	if(r < pos || l > pos) return;
	if(l == r){
		st[v] += val;
		return;
	}
	int md = (l+r)/2;
	update(v*2,l,md,pos,val);
	update(v*2+1,md+1,r,pos,val);
	st[v] = st[v*2] +st[v*2+1]; 
}
int query(int v, int l, int r, int i, int j){
	if(r < i || l > j) return 0;
	if(i <= l && r <= j) return st[v];
	int md = (l+r)/2;
	return query(v*2,l,md,i,j) + query(v*2+1,md+1,r,i,j);
}
int GetBestPosition(int n, int c, int r, int *k, int *s, int *e) {
	for (int i = 0; i < c; ++i)
	{
		rngs.pb({s[i]+query(1,0,n-1,0, s[i]-1),e[i]+query(1,0,n-1,0, s[i]-1)+query(1,0,n-1,s[i], e[i])});
		update(1,0,n-1,s[i], e[i]-s[i]);
	}
	int mx = 0, ps = 0;
	for (int i = 0; i < n; ++i)
	{
		int res = 0, ind = i;
		for (int j = 0; j < c; ++j)
		{	
			if(rngs[j].fi <= i && i <= rngs[j].se){
				int cur =0;
				for (int ar = rngs[j].fi; ar < rngs[j].se; ++ar)
				{
					cur = max(cur, k[ar]);
				}
				if(cur < r)
					res++;
				else break;
			}
		}
		if(res > mx){
			mx = res;
			ps = i;
		}
	}
  	return ps;
}



    

Compilation message

advisor.cpp: In function 'int GetBestPosition(int, int, int, int*, int*, int*)':
advisor.cpp:53:16: warning: unused variable 'ind' [-Wunused-variable]
   53 |   int res = 0, ind = i;
      |                ^~~
/usr/bin/ld: /tmp/ccIu9LVt.o: in function `main':
advisor_grader.cpp:(.text.startup+0xe6): undefined reference to `ComputeAdvice(int*, int, int, int)'
collect2: error: ld returned 1 exit status

/usr/bin/ld: /tmp/ccO5KBLb.o: in function `main':
assistant_grader.cpp:(.text.startup+0x21e): undefined reference to `Assist(unsigned char*, int, int, int)'
collect2: error: ld returned 1 exit status