답안 #262884

# 제출 시각 아이디 문제 언어 결과 실행 시간 메모리
262884 2020-08-13T10:32:22 Z dolphingarlic Meandian (CEOI06_meandian) C++14
0 / 100
17 ms 308 KB
#include "libmean.h"
#include <bits/stdc++.h>
using namespace std;

int ans[100], c[5];

int main() {
    int n = Init();
    fill(ans, ans + n, -1);
    queue<int> cand;
    for (int i = 1; i <= n; i++) cand.push(i);
    while (cand.size() > 4) {
        for (int i = 0; i < 5; i++) {
            c[i] = cand.front();
            cand.pop();
        }
        map<int, vector<int>> occ;
        occ[Meandian(c[0], c[1], c[2], c[3])].push_back(4);
        occ[Meandian(c[0], c[1], c[2], c[4])].push_back(3);
        occ[Meandian(c[0], c[1], c[3], c[4])].push_back(2);
        occ[Meandian(c[0], c[2], c[3], c[4])].push_back(1);
        occ[Meandian(c[1], c[2], c[3], c[4])].push_back(0);
        int found, val = 0;
        for (pair<int, vector<int>> i : occ) {
            if (i.second.size() == 1) {
                found = i.second[0];
                val -= i.first;
            } else val += i.first;
        }
        ans[found - 1] = val;
        for (int i = 0; i < 5; i++) if (c[i] != found) cand.push(c[i]);
    }
    Solution(ans);
}

Compilation message

meandian.cpp: In function 'int main()':
meandian.cpp:30:19: warning: 'found' may be used uninitialized in this function [-Wmaybe-uninitialized]
   30 |         ans[found - 1] = val;
      |             ~~~~~~^~~
# 결과 실행 시간 메모리 Grader output
1 Incorrect 11 ms 256 KB too many queries
2 Incorrect 6 ms 256 KB too many queries
3 Incorrect 8 ms 256 KB too many queries
4 Incorrect 15 ms 256 KB too many queries
5 Incorrect 9 ms 256 KB too many queries
6 Incorrect 17 ms 308 KB too many queries
7 Incorrect 9 ms 256 KB too many queries
8 Incorrect 9 ms 256 KB too many queries
9 Incorrect 8 ms 256 KB too many queries
10 Incorrect 6 ms 256 KB too many queries