#define DEBUG 0
#include <bits/stdc++.h>
using namespace std;
#if DEBUG
// basic debugging macros
int __i__,__j__;
#define printLine(l) for(__i__=0;__i__<l;__i__++){cout<<"-";}cout<<endl
#define printLine2(l,c) for(__i__=0;__i__<l;__i__++){cout<<c;}cout<<endl
#define printVar(n) cout<<#n<<": "<<n<<endl
#define printArr(a,l) cout<<#a<<": ";for(__i__=0;__i__<l;__i__++){cout<<a[__i__]<<" ";}cout<<endl
#define print2dArr(a,r,c) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<a[__i__][__j__]<<" ";}cout<<endl;}
#define print2dArr2(a,r,c,l) cout<<#a<<":\n";for(__i__=0;__i__<r;__i__++){for(__j__=0;__j__<c;__j__++){cout<<setw(l)<<setfill(' ')<<a[__i__][__j__]<<" ";}cout<<endl;}
// advanced debugging class
// debug 1,2,'A',"test";
class _Debug {
public:
template<typename T>
_Debug& operator,(T val) {
cout << val << endl;
return *this;
}
};
#define debug _Debug(),
#else
#define printLine(l)
#define printLine2(l,c)
#define printVar(n)
#define printArr(a,l)
#define print2dArr(a,r,c)
#define print2dArr2(a,r,c,l)
#define debug
#endif
// define
#define MAX_VAL 999999999
#define MAX_VAL_2 999999999999999999LL
#define EPS 1e-6
#define mp make_pair
#define pb push_back
// typedef
typedef unsigned int UI;
typedef long long int LLI;
typedef unsigned long long int ULLI;
typedef unsigned short int US;
typedef pair<int,int> pii;
typedef pair<LLI,LLI> plli;
typedef vector<int> vi;
typedef vector<LLI> vlli;
typedef vector<pii> vpii;
typedef vector<plli> vplli;
// ---------- END OF TEMPLATE ----------
vi ind;
int ans[150];
int findAns(int l,int r,int c) {
int i,x,y;
cout << r-l+1;
for (i = l; i <= r; i++) cout << " " << ind[i]+1;
cout << endl;
cin >> x;
cout << r-l+2;
for (i = l; i <= r; i++) cout << " " << ind[i]+1;
cout << " " << ind[0]+1 << endl;
cin >> y;
if (x == y) {
if (l == r) ans[ind[l]] = c;
else {
int m = (l+r) / 2;
findAns(l,m,c),findAns(m+1,r,c);
}
}
return 0;
}
int main() {
int N;
cin >> N;
int i,j;
cout << N;
for (i = 0; i < N; i++) cout << " " << i+1,ind.pb(i);
cout << endl;
int C;
cin >> C;
for (i = 0; i < C; i++) {
ans[ind[0]] = i+1;
findAns(1,ind.size()-1,i+1);
ind.clear();
for (j = 0; j < N; j++) {
if (ans[j] == 0) ind.pb(j);
}
}
cout << 0;
for (i = 0; i < N; i++) cout << " " << ans[i];
cout << endl;
return 0;
}
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
13 ms |
308 KB |
Output is correct |
2 |
Correct |
16 ms |
324 KB |
Output is correct |
3 |
Execution timed out |
13 ms |
400 KB |
Time limit exceeded (wall clock) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
10 ms |
420 KB |
Output is correct |
2 |
Correct |
11 ms |
420 KB |
Output is correct |
3 |
Execution timed out |
9 ms |
420 KB |
Time limit exceeded (wall clock) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
6 ms |
496 KB |
Output is correct |
2 |
Correct |
12 ms |
496 KB |
Output is correct |
3 |
Correct |
19 ms |
544 KB |
Output is correct |
4 |
Execution timed out |
6 ms |
544 KB |
Time limit exceeded (wall clock) |
5 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
12 ms |
544 KB |
Output is correct |
2 |
Correct |
13 ms |
544 KB |
Output is correct |
3 |
Execution timed out |
16 ms |
544 KB |
Time limit exceeded (wall clock) |
4 |
Halted |
0 ms |
0 KB |
- |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Correct |
8 ms |
572 KB |
Output is correct |
2 |
Correct |
18 ms |
572 KB |
Output is correct |
3 |
Execution timed out |
10 ms |
572 KB |
Time limit exceeded (wall clock) |
4 |
Halted |
0 ms |
0 KB |
- |