답안 #68630

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
68630 2018-08-17T17:51:08 Z KLPP 코알라 (APIO17_koala) C++14
19 / 100
27 ms 1052 KB
#include "koala.h"
#include<vector>
#include<iostream>

using namespace std;
int minValue(int N, int W) {
	int arr[N];
	for(int i=0;i<N;i++)arr[i]=0;
	arr[0]=1;
	int R[N];
	playRound(arr,R);
	if(R[0]<2){
		return 0;
	}else{
		for(int i=0;i<N;i++){
			if(R[i]==0)return i;
		}
	}
    return 0;
}



int maxValue(int N, int W) {
	vector<int> v;
	for(int i=0;i<N;i++)v.push_back(i);
	while(v.size()>1){
		int d=N/v.size();
		d=min(d,13);
		int arr[N];
		for(int i=0;i<N;i++){
			arr[i]=0;
		}
		for(int i=0;i<v.size();i++){
			arr[v[i]]=d;
		}/*for(int i=0;i<N;i++)cout<<arr[i]<<" ";
		cout<<endl;*/
		int sol[N];
		playRound(arr,sol);
		vector<int> V;
		for(int i=0;i<N;i++){
			if(sol[i]>d)V.push_back(i);
		}
		v=V;
	}
	/*for(int i=0;i<v.size();i++){
		cout<<v[i]<<" ";
	}*/
    return v[0];
}

int greaterValue(int N, int W) {
    // TODO: Implement Subtask 3 solution here.
    // You may leave this function unmodified if you are not attempting this
    // subtask.
    return 0;
}

void allValues(int N, int W, int *P) {
    if (W == 2*N) {
	int n=N;
        int arr[n];
	for(int i=0;i<n;i++)arr[i]=-1;
	for(int i=0;i<14;i++){
		int b[n];
		int r[n];
		for(int j=0;j<n;j++){
			if(arr[j]==-1)b[i]=0;
			else b[i]=arr[i];
		}
	}
    } else {
        // TODO: Implement Subtask 5 solution here.
        // You may leave this block unmodified if you are not attempting this
        // subtask.
    }
}

Compilation message

koala.cpp: In function 'int maxValue(int, int)':
koala.cpp:34:16: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   for(int i=0;i<v.size();i++){
               ~^~~~~~~~~
koala.cpp: In function 'void allValues(int, int, int*)':
koala.cpp:65:7: warning: variable 'b' set but not used [-Wunused-but-set-variable]
   int b[n];
       ^
koala.cpp:66:7: warning: unused variable 'r' [-Wunused-variable]
   int r[n];
       ^
# 결과 실행 시간 메모리 Grader output
1 Correct 7 ms 376 KB Output is correct
2 Correct 8 ms 520 KB Output is correct
3 Correct 7 ms 520 KB Output is correct
4 Correct 8 ms 540 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 21 ms 648 KB Output is correct
2 Correct 19 ms 888 KB Output is correct
3 Correct 27 ms 920 KB Output is correct
4 Correct 19 ms 1052 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 3 ms 1052 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1052 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 2 ms 1052 KB Output isn't correct
2 Halted 0 ms 0 KB -