# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
136312 |
2019-07-25T06:33:23 Z |
윤교준(#3260) |
Meandian (CEOI06_meandian) |
C++14 |
|
7 ms |
376 KB |
#include "libmean.h"
#include <bits/stdc++.h>
#define eb emplace_back
using namespace std;
typedef pair<int, int> pii;
static int ask(int a, int b, int c, int d) { return Meandian(a, b, c, d) << 1; }
static int N;
static int A[105];
static void process() {
fill(A, A+N+1, -1);
vector<int> V;
for(int i = 1; i <= 4; i++) V.eb(i);
for(int i = 5; i <= N; i++) {
vector<pii> TV;
V.eb(i);
TV.eb(0, ask(V[1], V[2], V[3], V[4]));
TV.eb(1, ask(V[0], V[2], V[3], V[4]));
TV.eb(2, ask(V[0], V[1], V[3], V[4]));
TV.eb(3, ask(V[0], V[1], V[2], V[4]));
TV.eb(4, ask(V[0], V[1], V[2], V[3]));
map<int, int> CMP;
for(auto &v : TV) CMP[v.second]++;
int mds;
for(auto &v : CMP) if(1 == v.second) mds = v.first;
int mdi;
for(auto &v : TV) if(v.second == mds) mdi = v.first;
int ls = -1, rs = -1;
for(auto &v : CMP) if(2 == v.second) {
if(ls < 0) ls = v.first;
else rs = v.first;
}
A[V[mdi]] = (ls + rs - mds) >> 1;
V.erase(V.begin() + mdi);
}
}
int main() {
N = Init();
process();
Solution(A+1);
return 0;
}
Compilation message
meandian.cpp: In function 'int main()':
meandian.cpp:40:10: warning: 'mdi' may be used uninitialized in this function [-Wmaybe-uninitialized]
A[V[mdi]] = (ls + rs - mds) >> 1;
^
meandian.cpp:31:7: note: 'mdi' was declared here
int mdi;
^~~
meandian.cpp:32:21: warning: 'mds' may be used uninitialized in this function [-Wmaybe-uninitialized]
for(auto &v : TV) if(v.second == mds) mdi = v.first;
^~
meandian.cpp:28:7: note: 'mds' was declared here
int mds;
^~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
2 ms |
376 KB |
Output is correct |
2 |
Correct |
2 ms |
248 KB |
Output is correct |
3 |
Correct |
3 ms |
376 KB |
Output is correct |
4 |
Correct |
2 ms |
248 KB |
Output is correct |
5 |
Correct |
3 ms |
376 KB |
Output is correct |
6 |
Correct |
3 ms |
376 KB |
Output is correct |
7 |
Correct |
4 ms |
376 KB |
Output is correct |
8 |
Correct |
7 ms |
376 KB |
Output is correct |
9 |
Correct |
7 ms |
248 KB |
Output is correct |
10 |
Correct |
6 ms |
248 KB |
Output is correct |