답안 #899296

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
899296 2024-01-05T17:07:31 Z AdamGS 코알라 (APIO17_koala) C++17
33 / 100
60 ms 728 KB
#include "koala.h"
#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define rep(a, b) for(int a = 0; a < (b); ++a)
#define st first
#define nd second
#define pb push_back
#define all(a) a.begin(), a.end()
int minValue(int N, int W) {
  int P[N], T[N];
  rep(i, N) P[i]=0;
  P[0]=1;
  playRound(P, T);
  rep(i, N) if(P[i]>=T[i]) return i;
  return 0;
}

int maxValue(int N, int W) {
  int P[N], T[N];
  vector<int>V(N);
  rep(i, N) V[i]=0;
  int ans=-1;
  while(true) {
    int ile=N;
    rep(i, N) if(V[i]) --ile;
    if(ile==1) {
      rep(i, N) if(!V[i]) ans=i;
      break;
    }
    rep(i, N) if(V[i]) P[i]=0; else P[i]=W/ile;
    playRound(P, T);
    rep(i, N) if(P[i]>=T[i]) V[i]=1;
    int ans=0;
    rep(i, N) if(!V[i]) ++ans;
  }
  return ans;
}

int greaterValue(int N, int W) {
  int P[N], T[N], po=1, ko=8;
  rep(i, N) P[i]=0;
  while(po<ko) {
    int sr=(po+ko)/2;
    P[0]=P[1]=sr;
    playRound(P, T);
    if(T[0]>sr && T[1]<=sr) return 0;
    if(T[0]<=sr && T[1]>sr) return 1;
    if(T[0]>sr) po=sr+1; else ko=sr-1;
  }
  P[0]=P[1]=po;
  playRound(P, T);
  if(T[0]<=po) return 1;
  return 0;
}

bool comp(int a, int b) {
  int P[100], T[100];
  rep(i, 100) P[i]=0;
  P[a]=P[b]=100;
  playRound(P, T);
  if(T[a]<=P[a]) return true;
  return false;
}

void allValues(int N, int W, int *P) {
    if (W == 2*N) {
      rep(i, N) P[i]=i;
      stable_sort(P, P+N, comp);
    } else {
        // TODO: Implement Subtask 5 solution here.
        // You may leave this block unmodified if you are not attempting this
        // subtask.
    }
}
# 결과 실행 시간 메모리 Grader output
1 Correct 4 ms 344 KB Output is correct
2 Correct 3 ms 452 KB Output is correct
3 Correct 3 ms 344 KB Output is correct
4 Correct 3 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Correct 10 ms 344 KB Output is correct
2 Correct 11 ms 452 KB Output is correct
3 Correct 10 ms 344 KB Output is correct
4 Correct 10 ms 344 KB Output is correct
# 결과 실행 시간 메모리 Grader output
1 Partially correct 50 ms 344 KB Output is partially correct
2 Partially correct 60 ms 448 KB Output is partially correct
3 Partially correct 57 ms 600 KB Output is partially correct
4 Partially correct 48 ms 460 KB Output is partially correct
5 Partially correct 49 ms 472 KB Output is partially correct
6 Partially correct 49 ms 468 KB Output is partially correct
7 Partially correct 48 ms 464 KB Output is partially correct
8 Partially correct 50 ms 460 KB Output is partially correct
9 Partially correct 56 ms 728 KB Output is partially correct
10 Partially correct 48 ms 460 KB Output is partially correct
# 결과 실행 시간 메모리 Grader output
1 Incorrect 18 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -
# 결과 실행 시간 메모리 Grader output
1 Incorrect 0 ms 344 KB Output isn't correct
2 Halted 0 ms 0 KB -