← Retour à l'épreuve

Kazakhstan FAIO 2024 · Énoncé

B. The Story of a Meteorologist

Mis en forme par IOAI Training à partir de l'original (BeksultanSagyndyk/faio-tasks, licence Apache-2.0). L'original fait foi.

https://contest.yandex.ru/contest/69765/problems/B/

❄️ Outlier Detection — The Tuyuksu Ice Incident

Adilkhan is a senior meteorologist working at Kazhydromet in Almaty. He frequently sends his intern, Darkhan, to the T1-Tuyuksu meteorological station to measure ice purity. The T1-Tuyuksu station is located far from the city, and getting there takes about two hours. Because of this, Darkhan disliked going there and sometimes just took ice from his refrigerator, recording its purity as if it were data from the meteorological station. This went on for the past 12 months. One day, Adilkhan noticed an unusual ice purity value in the data provided by Darkhan. When Adilkhan found out about the deception, he fired Darkhan. To avoid losing a year’s worth of data, Adilkhan wants to identify and remove outliers from the dataset. Since he is not well-versed in mathematics, he asks you to develop an algorithm for detecting outliers.


📘 Background

Outlier detection is the process of identifying data points that significantly differ from other observations in a dataset. Outliers can arise for various reasons, including measurement errors, unusual events, or fraudulent activities. Detecting outliers is a critically important task because they can skew statistical analyses and disrupt the functioning of machine learning models. Identifying and removing them helps improve model quality and prediction accuracy. Some popular methods for outlier detection include:


🔬 Common Methods

  1. Interquartile Range (IQR) Method
    IQR is calculated as the difference between the 75th (Q3) and 25th (Q1) percentiles of the data. Q1 is the data point located precisely in the middle of the lower half of the dataset. Q3 is the point halfway between the median and the end of the dataset. Observations that fall outside the range Q1−1.5×IQR and Q3+1.5×IQR are considered outliers.

  2. Z-Score Method
    This method is used for data that follows a normal distribution. Outliers are identified as observations that deviate from the mean by more than a specified number of standard deviations (usually 2-3 standard deviations).


🧩 Task

Implement an Interquartile Range (IQR) algorithm and output all outlier values in a single line.


🧠 Input Format

A line containing N ice purity values separated by spaces.
Example:

692.056 407.201 797.644 397.407 428.119 657.923 540.432 444.642 665.911 744.022 982.501 752.015 427.482 751.302 435.347 558.297 630.11 653.566 558.706 584.351 312.409 876.855 931.914 865.281 829.511 529.933 87.275 837.23 683.911 718.03 683.625 970.281 744.134 851.223 557.42 587.348 429.599 1023.72 987.026 845.929 997.894 699.41 844.348 782.492 541.106 990.015 576.061 963.393 435.35 892.901 621.722 756.518 569.919 481.062 169.876 1007.985 1455.191 540.917 392.689 601.271 424.163 432.56 982.415 555.936 423.064 683.216 500.835 573.202 707.49 788.679 1004.738 569.68 591.483 877.486 905.237 447.597 988.612 684.804 748.585 575.19 397.722 750.859 743.064 970.992 898.995 780.045 969.228 729.248 594.166 1007.126 472.009 770.013 921.429 873.281 735.505 563.767 410.52 987.471 533.309 550.993 502.579 984.291 465.299 828.254 873.136 882.176 687.737 583.992 838.154 420.741 712.274 929.081 392.476 631.177 665.912 818.879 908.984 440.936 505.114 550.699 476.326 394.364 667.541 458.281 766.243 868.315 973.72 969.573 506.873 580.261 883.08 519.961 793.511 481.129 934.377 690.876 1009.734 936.422 486.13 803.225 945.052 740.781 411.908 553.44 586.282 583.802 815.444 663.562 990.486 564.023 1008.469 799.943 973.218 393.97 565.541 980.692 506.457 623.421 707.483 850.274 965.697 677.103 537.276 447.024 980.881 559.32 963.42 843.083 929.78 802.631 775.31 929.605 954.992 418.774 675.58 712.7 572.331 450.041 802.542 404.922 668.684 559.434 958.353 923.639 466.01 568.3 621.14 463.812 876.341 965.293 977.194 1007.08 680.731 731.61 659.428 837.011 479.295 785.695 593.107 982.688 701.777 447.646 762.043 457.32 664.459 857.003 447.931 836.188 709.199 741.326 988.788 503.488 769.871 967.143 622.47 626.393 688.216 790.944 1000.709 867.917 416.935 492.074 448.899 986.547 926.898 1000.558 730.874 405.314 726.236 434.492 832.387 1246.357 465.598 640.866 831.19 -29.596 706.791 986.571 565.205 471.489 668.444 526.067 396.896 655.039 544.505 524.85 814.985 687.2 633.341 778.943 416.099 584.841 697.994 808.806 457.736 385.627 437.362 395.236 458.454 387.735 722.103 450.289 540.031 868.402 989.936 708.004 847.451 966.616 793.303 596.599 832.271 414.134 407.979 553.929 490.119 859.995 455.293 509.758 782.002 711.836 438.655 874.066 609.195 653.14 888.989 841.176 399.818 560.36 560.448 973.371 960.013 968.008 792.054 836.254 429.009 912.772 406.561 744.445 685.356 434.937 908.464 463.099 778.21 597.64 533.528 449.753 888.658 865.607 530.469 427.253 733.901 872.572 870.08 403.18 841.622 874.346 942.241 611.459 972.295 665.559 919.918 764.35 684.761 776.058 513.326 831.328 506.123 934.717 788.14 925.146 846.196 880.63 549.646 458.392 393.47 898.309 478.923 717.615 624.35 1113.102 980.984 543.375 506.61 537.134 822.456 919.206 158.764 402.436 768.887 797.236 917.309 985.782 870.48 934.257 853.031 919.352 734.492 351.196 695.91 530.383 726.428 991.601 473.187 693.689 644.978 908.44 574.841 675.092 607.361 218.234 738.367 880.988 900.998 304.058 669.206 489.828 609.336 520.527 592.43 897.887 566.18 580.098 571.151 951.963 -37.062 661.785 1007.814 981.749 464.493 466.272 456.542 561.011 737.827 598.174 902.673 512.323 600.244 734.495 746.624 522.566 459.713 904.701 566.716 913.749 651.098 876.633 393.792 474.464 892.172 627.508 -107.155 695.511 748.841 777.346 820.544 675.788 943.177 779.283 869.252 520.832 623.275 516.975 849.725 749.972 470.329 436.064 972.02 516.816 860.461 791.538 394.169 932.445 492.99 924.479 674.76 472.322 378.933 421.803 892.695 658.801 386.151 978.001 723.361 738.022 746.154 636.903 541.548 -7.42 428.373 425.786 553.823 400.719 908.294 698.909 927.714 1225.41 639.429 797.176 815.48 1003.457 619.576 961.783 862.501 -68.864 708.789 445.083 853.628 638.408 592.588 816.813 689.816 961.139 654.219 626.559 444.719 755.785 551.663 849.271 815.529 582.837 460.484 899.481 565.325 656.97 780.972 544.995 874.008 359.133 774.293 679.519 561.527 528.304 586.174 846.79 940.323 697.865 920.191 747.736 944.067 965.851 515.463 979.171 607.903 775.373 461.844 590.099 475.398 545.566 596.513 719.443 830.796 493.613 801.186 816.474 1325.914 852.644 881.937 724.321 449.856 776.142 481.713 740.959 888.536 516.293 834.79 561.308 750.077 978.751 865.139 599.291 716.515 603.569 528.641 432.797 895.18 844.831 899.731 601.765 726.348 597.025 995.587 556.44 420.803 671.326 447.832 926.99 1005.87 725.023 895.69 953.214 544.476 633.678 907.486 978.839 643.944 500.405 944.251 483.921 874.7 888.297 664.051 1005.013 611.736 656.382 1146.516 900.867 736.174 788.41 935.554 789.742 816.718 862.834 718.294 590.363 739.877 717.017 881.728 788.462 566.309 744.506 858.949 594.054 933.247 934.828 681.618 756.699 888.77 985.64 854.742 490.098 862.467 801.651 713.515 286.553 741.508 848.815 602.843 557.236 965.92 863.322 667.181 443.519 419.068 708.146 501.955 427.814 788.119 464.016 446.354 900.22 792.505 549.04 604.537 665.401 569.093 639.623 1001.23 709.2 738.676 562.364 610.927 527.583 858.318 836.643 967.529 717.955 874.896 645.391 931.017 994.026 806.407 608.299 876.414 796.375 595.022 579.206 481.019 899.038 491.999 719.629 522.384 921.19 461.989 735.921 829.055 982.294 566.532 832.498 913.722 775.653 604.27 684.263 975.741 716.584 622.086 926.274 535.826 894.785 577.882 898.173 977.911 478.174 559.354 962.038 561.356 562.601 635.106 581.356 27.256 985.783 562.256 809.718 927.311 548.845 590.933 524.985 872.664 475.608 799.432 818.283 1014.123 989.949 994.005 -66.887 980.88 596.395 681.898 1005.298 891.322 942.681 755.897 823.188 524.127 801.958 954.413 740.247 412.375 922.166 464.739 788.627 872.193 862.594 526.43 516.4 672.773 763.328 387.034 716.78 514.241 806.977 515.667 435.714 920.923 486.747 974.251 825.642 812.56 504.221 948.655 420.075 953.581 685.692 562.936 428.006 943.472 451.125 794.162 811.799 465.051 1009.087 672.556 884.348 989.964 910.228 607.297 657.504 549.314 574.7 488.376 612.098 854.024 907.327 998.765 821.053 796.903 587.075 139.267 723.513 573.171 991.942 927.949 439.231 602.737 647.69 430.606 606.454 568.116 469.799 594.388 786.57 739.997 544.54 716.778 876.24 601.07 548.853 760.949 669.623 464.658 757.71 298.157 585.081 509.048 405.532 739.052 590.843 780.852 713.399 979.183 804.784 765.126 750.668 521.078 498.583 392.128 876.167 977.87 689.569 950.999 725.429 665.242 593.211 939.249 417.463 740.967 757.494 672.18 433.308 479.097 446.582 432.954 698.061 800.226 727.281 517.945 734.475 536.772 578.889 704.583 904.997 665.906 430.425 396.236 729.149 -7.972 845.787 933.702 649.665 635.976 938.811 631.629 942.208 576.84 629.176 878.38 826.993 946.184 860.52 703.59 550.818 830.619 495.399 536.194 944.898 508.605 723.912 758.331 404.916 595.459 729.284 965.876 577.508 894.461 394.151 307.478 620.354 623.903 963.306 922.86 970.049 795.739 488.854 668.487 598.982 651.431 951.229 629.139 651.024 594.085 533.712 636.847 403.255 928.405 740.02 -84.543 591.56 616.152 487.799 700.747 874.348 562.155 729.956 807.139 486.525 966.972 849.554 947.49 691.302 914.336 878.462 408.09 682.199 954.083 1348.399 880.544 440.259 402.738 973.897 776.077 536.031 982.922 656.835 509.234 630.454 991.852 892.379 969.191 855.399 856.294 523.448 -75.874 607.81 563.201 675.792 811.065 830.479 494.504 497.166 951.353 853.569 406.142 792.527 611.728 774.366 595.953 631.538 575.375 608.468 762.43 843.438 960.767 565.191 -85.894 931.565 785.632 609.609 578.931 567.118 487.197 616.151 828.873 630.309 495.892 529.31 526.909 534.181 752.59 672.339 79.269 742.349 1006.987 594.1 793.952 580.338 614.007 619.235 517.055 834.94 920.746 693.334 762.989 780.314 888.821 633.912 887.499 719.853 750.511 692.704 669.984 452.875 672.013 407.589 529.93 865.404 833.141 1002.124 434.475 824.401 979.003 663.447 393.332 1048.964 705.007 844.84 874.495 549.474 994.308 830.284 710.5 829.424 527.821 793.863 963.539 633.095 931.277 676.247 661.552 883.718 758.14 802.739 522.802 829.914 794.789 465.015 737.359 441.266 940.254 753.756 580.541 499.512


🧾 Output Format

A single line with all detected outlier values separated by spaces.
Example:

1455.191 -29.596 -37.062 -107.155 -7.42 -68.864 27.256 -66.887 -7.972 -84.543 1348.399 -75.874 -85.894


💡 Sample

Input

692.056 407.201 797.644 397.407 428.119 657.923 540.432 444.642 665.911 744.022 … (more values)

Output

1455.191 -29.596 -37.062 -107.155 -7.42 -68.864 27.256 -66.887 -7.972 -84.543 1348.399 -75.874 -85.894


🧮 Language

Python 3.12.3