Submission #68639

# Submission time Handle Problem Language Result Execution time Memory
68639 2018-08-17T18:15:32 Z KLPP Koala Game (APIO17_koala) C++14
19 / 100
18 ms 804 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;
	}
	
    return v[0];
}

int greaterValue(int N, int W) {
	int lo,hi;
	lo=-1;
	hi=7;
	while(hi-lo>1){
		int n=N;
		int mid=(hi+lo)/2;
		int arr[n];
		for(int i=0;i<n;i++)arr[i]=0;
		arr[0]=mid;
		arr[1]=mid;
		int b[n];
		playRound(arr,b);
		/*for(int i=0;i<n;i++)cout<<b[i]<<" ";
		cout<<endl;*/
		int cnt=0;
		for(int i=2;i<n;i++){
			if(b[i]==0)cnt++;
		}
		if(b[0]>b[1] && cnt>0)return 1;
		if(b[1]>b[0] && cnt>0)return 0;
		if(b[0]>b[1] && cnt==0)return 0;
		if(b[1]>b[0] && cnt==0)return 1;
		if(b[0]==0)hi=mid;
		else lo=mid;
		
	}
    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 {
	int n=N;
	for(int i=0;i<n;i++){
		int b[n];
		int lo,hi;
		lo=0;
		hi=20;
		//while(hi-lo>1)
	}
    }
}

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:86:7: warning: variable 'b' set but not used [-Wunused-but-set-variable]
   int b[n];
       ^
koala.cpp:87:7: warning: unused variable 'r' [-Wunused-variable]
   int r[n];
       ^
koala.cpp:96:7: warning: unused variable 'b' [-Wunused-variable]
   int b[n];
       ^
koala.cpp:97:7: warning: variable 'lo' set but not used [-Wunused-but-set-variable]
   int lo,hi;
       ^~
koala.cpp:97:10: warning: variable 'hi' set but not used [-Wunused-but-set-variable]
   int lo,hi;
          ^~
# Verdict Execution time Memory Grader output
1 Correct 10 ms 504 KB Output is correct
2 Correct 6 ms 504 KB Output is correct
3 Correct 7 ms 504 KB Output is correct
4 Correct 8 ms 676 KB Output is correct
# Verdict Execution time Memory Grader output
1 Correct 18 ms 712 KB Output is correct
2 Correct 17 ms 712 KB Output is correct
3 Correct 18 ms 784 KB Output is correct
4 Correct 16 ms 784 KB Output is correct
# Verdict Execution time Memory Grader output
1 Incorrect 3 ms 804 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 804 KB Output isn't correct
2 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Incorrect 2 ms 804 KB Output isn't correct
2 Halted 0 ms 0 KB -