Submission #262884

#TimeUsernameProblemLanguageResultExecution timeMemory
262884dolphingarlicMeandian (CEOI06_meandian)C++14
0 / 100
17 ms308 KiB
#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 (stderr)

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;
      |             ~~~~~~^~~
#Verdict Execution timeMemoryGrader output
Fetching results...