답안 #29046

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
29046 2017-07-18T07:29:33 Z aybala 코끼리 (Dancing Elephants) (IOI11_elephants) C++11
0 / 100
99 ms 17644 KB
#include "elephants.h"
#include<bits/stdc++.h>
#define fori(a,b,c) for(a=b; a<c; a++)
#define ford(a,b,c) for(a=b; a>=c; a--)
#define mp make_pair
#define pb push_back
#define ll long long
#define pii pair<int,int>
using namespace std;
int n;

int cam;

int a[2];

int Ll;
void init(int N, int L, int X[])
{
	int i,j,k;
	int l = X[0];
	a[0]=X[0];
	a[1]=X[1];
	cam = 1;
	fori(i,1,N){
		if(X[i]-l>L){
			l=X[i];
			cam++;
		}
	}
	n=N;
	Ll=L;
}

int update(int i, int y)
{
	if(i==2){
		a[0]=a[1]=y;
		return cam;
	}
	
	if(i==1){
		if(abs(a[1]-y)>abs(a[0]-y)){
			a[1]=y;
		}
		else{
			a[0]=y;
		}
		int l = a[0];
		cam = 1;
		fori(i,1,n){
			if(a[i]-l>Ll){
				l=a[i];
				cam++;
			}
		}	
	}
	
	return cam;
}

Compilation message

elephants.cpp: In function 'void init(int, int, int*)':
elephants.cpp:19:8: warning: unused variable 'j' [-Wunused-variable]
  int i,j,k;
        ^
elephants.cpp:19:10: warning: unused variable 'k' [-Wunused-variable]
  int i,j,k;
          ^
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 17644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 17644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 6 ms 17644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 26 ms 17644 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 99 ms 17644 KB Output isn't correct
2 Halted 0 ms 0 KB -