TopCoder

icube
baluteshih 好強 <(_ _)>

User's AC Ratio

75.0% (75/100)

Submission's AC Ratio

15.8% (114/720)

Tags

Description

在你面前有 $n$ 個箱子,編號依序為 $1 \sim n$。 ($n \le 1499$,而且 $n$ 是奇數)

每個箱子裡面都有一個數字 $Y_i$,$1 \le Y_i \le n$ 且每個箱子的數字都不重複,

換句話說箱子裡的數字,$1 \sim n$ 都會剛好出現一次。

本題為互動題,你必須要使用給定的函式求出這些數字的中位數在哪個位置。

請先引入標頭檔 #include "lib1617.h"</font>

=====================

int Get_Box( void ) :在作任何操作之前請先呼叫這個函式,會回傳n的數值。

int Med3( int a, int b, int c ) :會回傳一個數字 $k$ 表示 $Y_a, Y_b, Y_c$ 三個數的中位數是 $Y_k$。

void Report( int a ) :表示全部 $n$ 個箱子的中位數是 $Y_a$。並且幫你結束程式。

Input Format

本題無需輸入,任何輸入動作會導致你得到一個 WA。

Output Format

本題無需輸出,請 Report 答案。

Hints

一個完全不會AC的範例程式:

#include <cstdio>
#include "lib1617.h"
int n, ans;
int main(){
    n = Get_Box();
    ans = Med3(1, 2, 3);
    Report(ans);
}

=====================

一些導致 WA 的原因:

  1. 沒有呼叫 Get_Box()
  2. 違法呼叫 Med3(),例如說三個數有重複的數值或是有 $1 \sim n$ 以外的數值。
  3. 呼叫 Med3() 超過 $7777$ 次。
  4. Report() 的答案錯誤。
  5. 讀入任何資料 / 輸出任何資料。

程式會在每次呼叫 Med3() 時引入一定量的延時,而時限也有做相對應的放寬。

Problem Source

原TIOJ1617 / Problem Setter:ATP
Source:IOI 2000 Day 1
2021.05.01 Update: Added $\LaTeX$ by FHVirus

Subtasks

No. Testdata Range Score
1 0 20
2 1 20
3 2 20
4 3 20
5 4 20

Testdata and Limits

No. Time Limit (ms) Memory Limit (VSS, KiB) Output Limit (KiB) Subtasks
0 1600 65536 262144 1
1 1600 65536 262144 2
2 1600 65536 262144 3
3 1600 65536 262144 4
4 1600 65536 262144 5