QOJ.ac
QOJ
ID | Problem | Submitter | Result | Time | Memory | Language | File size | Submit time | Judge time |
---|---|---|---|---|---|---|---|---|---|
#333780 | #7804. Intersegment Activation | yhk1001 | WA | 1ms | 3704kb | C++14 | 1.2kb | 2024-02-20 15:37:08 | 2024-02-20 15:37:08 |
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;
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;
}
Details
Tip: Click on the bar to expand more detailed information
Test #1:
score: 100
Accepted
time: 0ms
memory: 3688kb
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: 3704kb
input:
1 0 1
output:
1 1
result:
ok OK, 1 queries
Test #3:
score: 0
Accepted
time: 1ms
memory: 3692kb
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: 3576kb
input:
2 0 0 1 2
output:
1 2 2 2 1 1
result:
ok OK, 3 queries
Test #5:
score: 0
Accepted
time: 0ms
memory: 3532kb
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: 0ms
memory: 3596kb
input:
2 0 2
output:
1 2
result:
ok OK, 1 queries
Test #7:
score: 0
Accepted
time: 0ms
memory: 3516kb
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: 3688kb
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: 3624kb
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: 3620kb
input:
3 0 3
output:
1 3
result:
ok OK, 1 queries
Test #11:
score: -100
Wrong Answer
time: 1ms
memory: 3688kb
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