#include <bits/stdc++.h>
#include "grader.h"
using namespace std;
vector <int> findSequence(int N){
int C = isSubsequence(vector<int>(N/2+1 ,0)) ,cnt = 1;
while(isSubsequence(vector<int>(cnt ,C)))
cnt++;
if(--cnt == 0)
return vector <int>(N ,!C);
vector <int> pos;
for(int i=cnt; i>=0; i--){
vector <int> q(cnt ,C);
q.insert(q.begin()+i ,!C);
if(isSubsequence(q))
pos.push_back(i);
}
int rem = N - cnt;
vector <int> dis(pos.size() ,-1);
for(int i=0; i<pos.size(); i++){
vector <int> q(cnt ,C);
for(int l = 1; l <= N/4 + 1; l++){
q.insert(q.begin()+pos[i] ,!C);
if(!isSubsequence(q)){
dis[i] = l-1;
rem -= l-1;
break;
}
}
}
if(rem)
*find(dis.begin() ,dis.end() ,-1) = rem;
vector <int> ans(cnt ,C);
for(int i=0; i<pos.size(); i++)
while(dis[i]-- > 0) ans.insert(ans.begin()+pos[i] ,!C);
return ans;
}
Compilation message
hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:22:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
22 | for(int i=0; i<pos.size(); i++){
| ~^~~~~~~~~~~
hidden.cpp:38:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
38 | for(int i=0; i<pos.size(); i++)
| ~^~~~~~~~~~~
grader.cpp: In function 'int main()':
grader.cpp:28:26: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wformat=]
28 | fprintf (fifo_out, "%d\n", ans.size ());
| ~^ ~~~~~~~~~~~
| | |
| int std::vector<int>::size_type {aka long unsigned int}
| %ld
grader.cpp:29:20: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
29 | for (int i=0; i<ans.size () && i < N; i++)
| ~^~~~~~~~~~~~
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
1 ms |
364 KB |
Output is partially correct: Maximum length of a query = 7 |
2 |
Partially correct |
1 ms |
364 KB |
Output is partially correct: Maximum length of a query = 8 |
3 |
Partially correct |
1 ms |
364 KB |
Output is partially correct: Maximum length of a query = 7 |
4 |
Partially correct |
1 ms |
364 KB |
Output is partially correct: Maximum length of a query = 7 |
5 |
Incorrect |
1 ms |
364 KB |
Output is not correct: The returned sequence does not match the hidden one |
# |
결과 |
실행 시간 |
메모리 |
Grader output |
1 |
Partially correct |
6 ms |
364 KB |
Output is partially correct: Maximum length of a query = 86 |
2 |
Partially correct |
7 ms |
364 KB |
Output is partially correct: Maximum length of a query = 92 |
3 |
Partially correct |
8 ms |
364 KB |
Output is partially correct: Maximum length of a query = 102 |
4 |
Partially correct |
6 ms |
364 KB |
Output is partially correct: Maximum length of a query = 87 |
5 |
Partially correct |
8 ms |
364 KB |
Output is partially correct: Maximum length of a query = 103 |
6 |
Partially correct |
7 ms |
364 KB |
Output is partially correct: Maximum length of a query = 130 |
7 |
Partially correct |
7 ms |
364 KB |
Output is partially correct: Maximum length of a query = 144 |
8 |
Partially correct |
5 ms |
364 KB |
Output is partially correct: Maximum length of a query = 124 |
9 |
Partially correct |
8 ms |
364 KB |
Output is partially correct: Maximum length of a query = 126 |
10 |
Partially correct |
8 ms |
492 KB |
Output is partially correct: Maximum length of a query = 125 |
11 |
Partially correct |
8 ms |
364 KB |
Output is partially correct: Maximum length of a query = 97 |
12 |
Incorrect |
8 ms |
364 KB |
Output is not correct: The returned sequence does not match the hidden one |
13 |
Halted |
0 ms |
0 KB |
- |