답안 #772901

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
772901 2023-07-04T12:32:08 Z alontanay 미술 수업 (IOI13_artclass) C++14
84 / 100
471 ms 6092 KB
#include "artclass.h"

#include <bits/stdc++.h>

using namespace std;

double noise(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    double res = 1e18;
    const int NOISE_RAD = 25;
    const int PAD = 0;
    for (int er = NOISE_RAD + PAD; er < H - PAD; er++) {
        int sr = er - NOISE_RAD;
        for (int ec = NOISE_RAD + PAD; ec < W - PAD; ec++) {
            int sc = ec - NOISE_RAD;
            double score = 0;
            double rSum = 0, gSum = 0, bSum = 0;
            for (int r = sr; r < er; r++) {
                for (int c = sc; c < ec; c++) {
                    rSum += R[r][c];
                    gSum += G[r][c];
                    bSum += B[r][c];
                    // cout << R[r][c] << " ";
                }
                // cout << endl;
            }
            double aveR = rSum / (NOISE_RAD * NOISE_RAD);
            double aveG = gSum / (NOISE_RAD * NOISE_RAD);
            double aveB = bSum / (NOISE_RAD * NOISE_RAD);
            // cout << aveR << " " << aveG << " " << aveB << " " << sr << " " <<
            // er
            //      << " " << sc << " " << ec << endl;
            for (int r = sr; r < er; r++) {
                for (int c = sc; c < ec; c++) {
                    double difR = (aveR - R[r][c]);
                    double difG = (aveG - G[r][c]);
                    double difB = (aveB - B[r][c]);
                    score += abs(difR) + abs(difG) + abs(difB);
                }
            }
            // cout << score << endl;
            res = min(res, score);
        }
    }
    return res;
}

int style(int H, int W, int R[500][500], int G[500][500], int B[500][500]) {
    double nos = noise(H, W, R, G, B);
    if (nos < 2500) {
        int blackL = W;
        int blackR = 0;
        int blackU = H;
        int blackD = 0;
        for (int r = 0; r < H; r++) {
            for (int c = 0; c < W; c++) {
                if (R[r][c] + G[r][c] + B[r][c] < 60 && R[r][c] < 50 &&
                    G[r][c] < 50 && B[r][c] < 50) {
                    blackL = min(blackL, c);
                    blackR = max(blackR, c);
                    blackU = min(blackU, r);
                    blackD = max(blackD, r);
                }
            }
        }
        const int PAD = 200;
        // cout << "!" << blackL << " " << W - blackR << " " << blackU << " "
        //      << H - blackD << endl;
        if (blackL < PAD && blackR > W - PAD && blackU < PAD &&
            blackD > H - PAD) {
            return 1;
        } else {
            return 4;
        }
    }
    if (nos > 12000) {
        return 3;
    } else {
        return 2;
    }
    double sumR = 0, sumG = 0, sumB = 0;
    for (int r = 0; r < H; r++) {
        for (int c = 0; c < W; c++) {
            sumR += R[r][c];
            sumG += G[r][c];
            sumB += B[r][c];
        }
    }
    sumR /= (H * W);
    sumG /= (H * W);
    sumB /= (H * W);
    if (sumG > max(sumR, sumB) - 15) {
        return 2;
    }
    srand(time(0));
    vector<int> opts = {1, 4};
    return opts[rand() % 2];
}
# 결과 실행 시간 메모리 Grader output
1 Incorrect 392 ms 5364 KB Output isn't correct
2 Correct 336 ms 5348 KB Output is correct
3 Incorrect 414 ms 6040 KB Output isn't correct
4 Correct 350 ms 4856 KB Output is correct
5 Correct 336 ms 5196 KB Output is correct
6 Correct 376 ms 5412 KB Output is correct
7 Correct 271 ms 5024 KB Output is correct
8 Correct 69 ms 1416 KB Output is correct
9 Correct 260 ms 4888 KB Output is correct
10 Correct 246 ms 4640 KB Output is correct
11 Correct 368 ms 5212 KB Output is correct
12 Correct 345 ms 4776 KB Output is correct
13 Correct 160 ms 2464 KB Output is correct
14 Correct 357 ms 5448 KB Output is correct
15 Correct 332 ms 5184 KB Output is correct
16 Correct 265 ms 4728 KB Output is correct
17 Correct 355 ms 4904 KB Output is correct
18 Correct 413 ms 5928 KB Output is correct
19 Incorrect 331 ms 5320 KB Output isn't correct
20 Correct 235 ms 4664 KB Output is correct
21 Correct 471 ms 5956 KB Output is correct
22 Incorrect 338 ms 4588 KB Output isn't correct
23 Incorrect 396 ms 5416 KB Output isn't correct
24 Incorrect 344 ms 5172 KB Output isn't correct
25 Incorrect 341 ms 4620 KB Output isn't correct
26 Correct 341 ms 5192 KB Output is correct
27 Correct 308 ms 5140 KB Output is correct
28 Incorrect 455 ms 5852 KB Output isn't correct
29 Correct 346 ms 5200 KB Output is correct
30 Correct 343 ms 4588 KB Output is correct
31 Correct 344 ms 5292 KB Output is correct
32 Correct 359 ms 4808 KB Output is correct
33 Correct 351 ms 4872 KB Output is correct
34 Correct 244 ms 4644 KB Output is correct
35 Incorrect 342 ms 4644 KB Output isn't correct
36 Correct 369 ms 5848 KB Output is correct
37 Correct 332 ms 4668 KB Output is correct
38 Correct 366 ms 5328 KB Output is correct
39 Correct 365 ms 5748 KB Output is correct
40 Correct 217 ms 3048 KB Output is correct
41 Incorrect 346 ms 5068 KB Output isn't correct
42 Correct 415 ms 5920 KB Output is correct
43 Correct 348 ms 5392 KB Output is correct
44 Correct 323 ms 5348 KB Output is correct
45 Correct 246 ms 3588 KB Output is correct
46 Incorrect 317 ms 4304 KB Output isn't correct
47 Correct 357 ms 4448 KB Output is correct
48 Incorrect 432 ms 5884 KB Output isn't correct
49 Correct 319 ms 4456 KB Output is correct
50 Correct 328 ms 4476 KB Output is correct
51 Correct 447 ms 5984 KB Output is correct
52 Correct 263 ms 3712 KB Output is correct
53 Incorrect 309 ms 4436 KB Output isn't correct
54 Correct 251 ms 4752 KB Output is correct
55 Correct 377 ms 5500 KB Output is correct
56 Correct 224 ms 3284 KB Output is correct
57 Correct 279 ms 5140 KB Output is correct
58 Correct 345 ms 5156 KB Output is correct
59 Correct 158 ms 2456 KB Output is correct
60 Correct 369 ms 4740 KB Output is correct
61 Correct 330 ms 5032 KB Output is correct
62 Correct 353 ms 4964 KB Output is correct
63 Correct 304 ms 4360 KB Output is correct
64 Correct 341 ms 5272 KB Output is correct
65 Correct 418 ms 5836 KB Output is correct
66 Correct 401 ms 5700 KB Output is correct
67 Correct 397 ms 5792 KB Output is correct
68 Incorrect 288 ms 4052 KB Output isn't correct
69 Correct 389 ms 5796 KB Output is correct
70 Incorrect 319 ms 4296 KB Output isn't correct
71 Correct 349 ms 5336 KB Output is correct
72 Correct 390 ms 4812 KB Output is correct
73 Correct 347 ms 4728 KB Output is correct
74 Correct 94 ms 3668 KB Output is correct
75 Correct 346 ms 5328 KB Output is correct
76 Correct 357 ms 5468 KB Output is correct
77 Correct 262 ms 3784 KB Output is correct
78 Correct 421 ms 6092 KB Output is correct
79 Correct 205 ms 3116 KB Output is correct
80 Correct 228 ms 3144 KB Output is correct
81 Correct 319 ms 4280 KB Output is correct
82 Correct 337 ms 5280 KB Output is correct
83 Correct 249 ms 4812 KB Output is correct
84 Correct 322 ms 4416 KB Output is correct
85 Correct 431 ms 5904 KB Output is correct
86 Incorrect 217 ms 4692 KB Output isn't correct
87 Correct 424 ms 5524 KB Output is correct
88 Correct 196 ms 2640 KB Output is correct
89 Correct 196 ms 4392 KB Output is correct
90 Correct 278 ms 3668 KB Output is correct
91 Incorrect 425 ms 5964 KB Output isn't correct
92 Correct 331 ms 5068 KB Output is correct
93 Correct 433 ms 6036 KB Output is correct
94 Correct 282 ms 4852 KB Output is correct
95 Correct 280 ms 5100 KB Output is correct
96 Correct 350 ms 5364 KB Output is correct
97 Correct 312 ms 4168 KB Output is correct
98 Correct 303 ms 4428 KB Output is correct
99 Correct 324 ms 4348 KB Output is correct
100 Correct 262 ms 5024 KB Output is correct
101 Correct 282 ms 4988 KB Output is correct
102 Correct 205 ms 3108 KB Output is correct