답안 #94657

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
94657 2019-01-22T06:49:38 Z andy627 코끼리 (Dancing Elephants) (IOI11_elephants) C++17
0 / 100
2 ms 376 KB
#include "elephants.h"

#include <stdio.h>
#include <set>
#include <vector>
#include <algorithm>
#define pii pair<int,int>
#define ff first
#define ss second
#define INF 1e9
#define BUK 500
using namespace std;

int n,l,flag;
int X[111111];

set<int> st2;

void init2(){
	for(int i=0;i<n;i++) st2.insert(X[i]);
}

void init3(){
	
}

void init4(){

}

void init5(){

}

void init(int N, int L, int _X[]){
	n=N; l=L;
	for(int i=0;i<n;i++) X[i]=_X[i];

	if(n==2) flag=1;
	else if(n<=100) flag=2;
	else if(n<=50000) flag=3;
	else if(n<=70000) flag=4;
	else flag=5;

	switch(flag){
		case 1:
		case 2: //init2(); break;
		case 3: init3(); break;
		case 4: init4(); break;
		case 5: init5();
	}
}

int update2(int i,int y){
	st2.erase(X[i]);
	X[i]=y; st2.insert(X[i]);

	int cnt=0;
	set<int>::iterator it=st2.begin();
	while(it!=st2.end()) it=st2.upper_bound((*it)+l),cnt++;
	return cnt;
}

int update3(int i,int y){
	
}

int update4(int i,int y){
	return 0;
}

int update5(int i,int y){
	return 0;
}

int update(int i, int y){
	switch(flag){
		case 1:
		case 2: update2(i,y); break;
		case 3: update3(i,y); break;
		case 4: update4(i,y); break;
		case 5: update5(i,y);
	}
}

Compilation message

elephants.cpp: In function 'int update3(int, int)':
elephants.cpp:66:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
elephants.cpp: In function 'int update(int, int)':
elephants.cpp:84:1: warning: no return statement in function returning non-void [-Wreturn-type]
 }
 ^
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Correct 2 ms 376 KB Output is correct
2 Incorrect 2 ms 376 KB Output isn't correct
3 Halted 0 ms 0 KB -