# |
Submission time |
Handle |
Problem |
Language |
Result |
Execution time |
Memory |
225914 |
2020-04-22T02:38:41 Z |
erd1 |
Park (JOI17_park) |
C++14 |
|
80 ms |
632 KB |
#include "park.h"
#include<bits/stdc++.h>
#define all(x) (x).begin(), (x).end()
#define pb push_back
using namespace std;
template<typename Iter>
ostream& outIt(ostream& out, Iter b, Iter e){
for(Iter i = b; i != e; i++)
out << (i == b?"":" ") << *i;
return out;
}
template<typename T>
ostream& operator<<(ostream& out, vector<T>& v){
return outIt(out << '[', all(v)) << ']';
}
static int Place[1400];
int ran(){
static int x = 10292837;
return (x*0xdefaced+1)&INT_MAX;
}
bool ask(int l, int r){
//cout << l << " " << r << endl;
return Ask(min(l, r), max(l, r), Place);
}
void answer(int l, int r){
Answer(min(l, r), max(l, r));
}
void Sort(int l, int r, vector<int>& v){
//cout << l << " " <<r << " " << v<< endl;
if(v.size() == 0) return;
int pivot = v[ran()%v.size()];
for(auto i: v)Place[i] = 1; Place[l] = Place[r] = 1;
vector<int> R, L;
for(auto i: v)
if(i != pivot)
Place[i] = 0, (ask(l, pivot)?R:L).pb(i), Place[i] = 1;
for(auto i: v)Place[i] = 0; Place[l] = Place[r] = 0;
Sort(l, pivot, L); Sort(pivot, r, R);
auto st = copy(all(L), v.begin());
*st = pivot;
copy(all(R), next(st));
}
vector<int> v;
void Detect(int T, int N) {
if(T == 2){
v.resize(N-2);
iota(all(v), 1);
Sort(0, N-1, v);
v.insert(v.begin(), 0);
v.pb(N-1);
//cout << v << endl;
for(int i = 1; i < N; i++)answer(v[i-1], v[i]);
}
}
Compilation message
park.cpp: In function 'void Sort(int, int, std::vector<int>&)':
park.cpp:39:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for(auto i: v)Place[i] = 1; Place[l] = Place[r] = 1;
^~~
park.cpp:39:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
for(auto i: v)Place[i] = 1; Place[l] = Place[r] = 1;
^~~~~
park.cpp:44:5: warning: this 'for' clause does not guard... [-Wmisleading-indentation]
for(auto i: v)Place[i] = 0; Place[l] = Place[r] = 0;
^~~
park.cpp:44:33: note: ...this statement, but the latter is misleadingly indented as if it were guarded by the 'for'
for(auto i: v)Place[i] = 0; Place[l] = Place[r] = 0;
^~~~~
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Correct |
80 ms |
512 KB |
Output is correct |
2 |
Correct |
43 ms |
512 KB |
Output is correct |
3 |
Correct |
57 ms |
632 KB |
Output is correct |
4 |
Correct |
66 ms |
512 KB |
Output is correct |
5 |
Correct |
67 ms |
632 KB |
Output is correct |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |
# |
Verdict |
Execution time |
Memory |
Grader output |
1 |
Incorrect |
5 ms |
384 KB |
Wrong Answer[6] |
2 |
Halted |
0 ms |
0 KB |
- |