# | 제출 시각 | 아이디 | 문제 | 언어 | 결과 | 실행 시간 | 메모리 |
---|---|---|---|---|---|---|---|
68643 | 2018-08-17T18:45:39 Z | KLPP | 코알라 (APIO17_koala) | C++14 | 81 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; } return v[0]; } int compare(int x, int y,int N){ int lo,hi; lo=0; hi=14; 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[x]=mid; arr[y]=mid; int b[n]; playRound(arr,b); if(b[x]>b[y])return x; if(b[y]>b[x])return y; if(b[x]==0)hi=mid; else lo=mid; } return 0; } int greaterValue(int N, int W) { int lo,hi; lo=0; hi=14; 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); if(b[0]>b[1])return 0; if(b[1]>b[0])return 1; if(b[0]==0)hi=mid; else lo=mid; } return 0; } vector<int> order(int x,int y,int n){//cout<<x<<" "<<y<<endl; if(x==y){ vector<int> v; v.push_back(x); return v; } int mid=(x+y)/2; vector<int> v1=order(x,mid,n); vector<int> v2=order(mid+1,y,n); int p1=0; int p2=0; vector<int> ans; while(p1<v1.size()){//cout<<p1<<" "<<p2<<endl; //cout<<v1[p1]<<" "<<v2[p2]<<endl; while(p2<v2.size() && compare(v1[p1],v2[p2],n)==v1[p1]){ ans.push_back(v2[p2]); p2++; } ans.push_back(v1[p1]); p1++; } while(p2<v2.size()){ ans.push_back(v2[p2]); p2++; } /*cout<<"Print "<<x<<" A "<<y<<" B "; for(int i=0;i<ans.size();i++){ cout<<ans[i]<<" "; }cout<<endl;*/ return ans; } 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 { vector<int> v=order(0,N-1,N); //for(int i=0;i<N;i++)cout<<v[i]<<endl; for(int i=0;i<N;i++)P[v[i]]=i+1; } }
Compilation message
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 7 ms | 376 KB | Output is correct |
2 | Correct | 6 ms | 376 KB | Output is correct |
3 | Correct | 7 ms | 428 KB | Output is correct |
4 | Correct | 7 ms | 520 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 17 ms | 592 KB | Output is correct |
2 | Correct | 17 ms | 656 KB | Output is correct |
3 | Correct | 17 ms | 656 KB | Output is correct |
4 | Correct | 18 ms | 760 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Correct | 54 ms | 760 KB | Output is correct |
2 | Correct | 68 ms | 760 KB | Output is correct |
3 | Correct | 54 ms | 760 KB | Output is correct |
4 | Correct | 54 ms | 788 KB | Output is correct |
5 | Correct | 81 ms | 788 KB | Output is correct |
6 | Correct | 57 ms | 788 KB | Output is correct |
7 | Correct | 55 ms | 788 KB | Output is correct |
8 | Correct | 57 ms | 804 KB | Output is correct |
9 | Correct | 54 ms | 804 KB | Output is correct |
10 | Correct | 53 ms | 804 KB | Output is correct |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Incorrect | 2 ms | 804 KB | Output isn't correct |
2 | Halted | 0 ms | 0 KB | - |
# | 결과 | 실행 시간 | 메모리 | Grader output |
---|---|---|---|---|
1 | Partially correct | 17 ms | 804 KB | Output is partially correct |
2 | Partially correct | 25 ms | 804 KB | Output is partially correct |
3 | Partially correct | 27 ms | 804 KB | Output is partially correct |
4 | Partially correct | 27 ms | 804 KB | Output is partially correct |
5 | Partially correct | 25 ms | 848 KB | Output is partially correct |
6 | Partially correct | 25 ms | 848 KB | Output is partially correct |
7 | Partially correct | 28 ms | 848 KB | Output is partially correct |
8 | Partially correct | 39 ms | 872 KB | Output is partially correct |
9 | Partially correct | 25 ms | 872 KB | Output is partially correct |
10 | Partially correct | 25 ms | 872 KB | Output is partially correct |
11 | Partially correct | 24 ms | 872 KB | Output is partially correct |
12 | Partially correct | 17 ms | 872 KB | Output is partially correct |
13 | Partially correct | 25 ms | 872 KB | Output is partially correct |
14 | Partially correct | 25 ms | 872 KB | Output is partially correct |
15 | Partially correct | 25 ms | 872 KB | Output is partially correct |
16 | Partially correct | 25 ms | 872 KB | Output is partially correct |
17 | Partially correct | 24 ms | 872 KB | Output is partially correct |
18 | Partially correct | 26 ms | 872 KB | Output is partially correct |
19 | Partially correct | 26 ms | 872 KB | Output is partially correct |
20 | Partially correct | 25 ms | 872 KB | Output is partially correct |
21 | Partially correct | 26 ms | 872 KB | Output is partially correct |
22 | Partially correct | 24 ms | 872 KB | Output is partially correct |
23 | Partially correct | 25 ms | 956 KB | Output is partially correct |
24 | Partially correct | 27 ms | 960 KB | Output is partially correct |
25 | Partially correct | 23 ms | 960 KB | Output is partially correct |
26 | Partially correct | 26 ms | 960 KB | Output is partially correct |
27 | Partially correct | 26 ms | 960 KB | Output is partially correct |
28 | Partially correct | 24 ms | 960 KB | Output is partially correct |
29 | Partially correct | 28 ms | 960 KB | Output is partially correct |
30 | Partially correct | 25 ms | 960 KB | Output is partially correct |
31 | Partially correct | 26 ms | 960 KB | Output is partially correct |
32 | Partially correct | 25 ms | 1052 KB | Output is partially correct |
33 | Partially correct | 26 ms | 1052 KB | Output is partially correct |
34 | Partially correct | 24 ms | 1052 KB | Output is partially correct |
35 | Partially correct | 24 ms | 1052 KB | Output is partially correct |
36 | Partially correct | 23 ms | 1052 KB | Output is partially correct |
37 | Partially correct | 22 ms | 1052 KB | Output is partially correct |
38 | Partially correct | 24 ms | 1052 KB | Output is partially correct |
39 | Partially correct | 20 ms | 1052 KB | Output is partially correct |
40 | Partially correct | 23 ms | 1052 KB | Output is partially correct |