이 제출은 이전 버전의 oj.uz에서 채점하였습니다. 현재는 제출 당시와는 다른 서버에서 채점을 하기 때문에, 다시 제출하면 결과가 달라질 수도 있습니다.
#include <bits/stdc++.h>
using namespace std;
int v[160];
int main()
{
int dif , i , n , st , dr , mid , j , val1 , val2;
cin >> n;
dif = 0;
for (i = 1 ; i <= n ; i++){
if (!v[i]){
v[i] = ++dif;
}
/// acuma ar trb sa cauti urm = v[i]
if (n - i + 1 > 0){
cout << n - i + 1 << " ";
for (j = i ; j <= n ; j++)
cout << j << " ";
cout << endl;
cin >> val1;
}
else val1 = 0;
if (n - i > 0){
cout << n - i << " ";
for (j = i + 1 ; j <= n ; j++)
cout << j << " ";
cout << endl;
cin >> val2;
}
else val2 = 0;
if (val1 != val2){
/// v[i] nu mai apare nicaieri
continue;
}
/// v[i] mai apare , unde?
st = i + 1;
dr = n;
while (st <= dr){
mid = (st + dr)/2;
if (mid - i + 1 > 0){
cout << mid - i + 1 << " ";
for (j = i ; j <= mid ; j++)
cout << j << " ";
cout << endl;
cin >> val1;
}
else val1 = 0;
if (mid - i > 0){
cout << mid - i << " ";
for (j = i + 1 ; j <= mid ; j++)
cout << j << " ";
cout << endl;
cin >> val2;
}
else val2 = 0;
if (val1 == val2){
dr = mid - 1;
}
else st = mid + 1;
}
v[st] = v[i];
}
for (i = 1 ; i <= n ; i++)
cout << v[i] << " ";
return 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... |