QOJ.ac
QOJ
ID | 题目 | 提交者 | 结果 | 用时 | 内存 | 语言 | 文件大小 | 提交时间 | 测评时间 |
---|---|---|---|---|---|---|---|---|---|
#333782 | #7804. Intersegment Activation | yhk1001 | WA | 1ms | 3728kb | C++14 | 1.3kb | 2024-02-20 15:39:21 | 2024-02-20 15:39:21 |
Judging History
answer
#include <cstdio>
#include <iostream>
#include <algorithm>
#include <vector>
using namespace std;
// #define Debug
// #define LOCAL
// #define TestCases
const int N = 10;
int n;
vector<int> s[N + 5];
void init()
{
s[1].push_back(0), s[1].push_back(1);
for (int i = 2; i <= n; i++)
{
s[i] = s[i - 1];
for (auto it = s[i - 1].rbegin(); it != s[i - 1].rend(); it++)
s[i].push_back((*it) | (1 << (i - 1)));
}
return ;
}
int get_num()
{
int k;
cin >> k;
if (k == n)
exit(0);
return k;
}
void solve()
{
cin >> n;
init();
int bef = get_num();
for (int t = n; t > 0; t--)
{
int lst = 0;
s[t].push_back(0);
for (auto v : s[t])
{
if (v == lst)
continue;
int pos = __lg(lst ^ v) + 1;
lst = v;
cout << pos << " " << t << endl;
int cur = get_num();
if (cur == bef)//no change
continue;
if (cur > bef)//better
{
bef = cur;
break;
}
cout << pos << " " << t << endl;//worse
bef = get_num();
break;
}
}
return ;
}
int main()
{
#ifdef LOCAL
freopen("data.in", "r", stdin);
freopen("mycode.out", "w", stdout);
#endif
int T = 1;
#ifdef TestCases
scanf("%d", &T);
#endif
while (T--)
solve();
return 0;
}
详细
Test #1:
score: 100
Accepted
time: 1ms
memory: 3728kb
input:
3 0 0 0 1 3
output:
1 3 2 3 1 3 1 2
result:
ok OK, 4 queries
Test #2:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
1 0 1
output:
1 1
result:
ok OK, 1 queries
Test #3:
score: 0
Accepted
time: 0ms
memory: 3676kb
input:
2 1 0 1 2
output:
1 2 1 2 1 1
result:
ok OK, 3 queries
Test #4:
score: 0
Accepted
time: 0ms
memory: 3704kb
input:
2 0 0 1 2
output:
1 2 2 2 1 1
result:
ok OK, 3 queries
Test #5:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
2 0 0 0 1 2
output:
1 2 2 2 1 2 1 1
result:
ok OK, 4 queries
Test #6:
score: 0
Accepted
time: 1ms
memory: 3660kb
input:
2 0 2
output:
1 2
result:
ok OK, 1 queries
Test #7:
score: 0
Accepted
time: 1ms
memory: 3716kb
input:
3 0 1 2 3
output:
1 3 1 2 1 1
result:
ok OK, 3 queries
Test #8:
score: 0
Accepted
time: 1ms
memory: 3720kb
input:
3 0 0 0 0 0 1 1 2 3
output:
1 3 2 3 1 3 3 3 1 3 1 2 2 2 1 1
result:
ok OK, 8 queries
Test #9:
score: 0
Accepted
time: 1ms
memory: 3680kb
input:
3 0 0 0 0 0 0 0 1 1 1 2 3
output:
1 3 2 3 1 3 3 3 1 3 2 3 1 3 1 2 2 2 1 2 1 1
result:
ok OK, 11 queries
Test #10:
score: 0
Accepted
time: 0ms
memory: 3592kb
input:
3 0 3
output:
1 3
result:
ok OK, 1 queries
Test #11:
score: -100
Wrong Answer
time: 1ms
memory: 3676kb
input:
4 0 0 0 0 0 0 0 0 0 1 1 2 1 2 3
output:
1 4 2 4 1 4 3 4 1 4 2 4 1 4 4 4 1 4 1 3 2 3 1 2 1 2 1 1
result:
wrong answer format Unexpected end of file - int32 expected