이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#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]);
}
}
컴파일 시 표준 에러 (stderr) 메시지
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 |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |
# | Verdict | Execution time | Memory | Grader output |
---|
Fetching results... |