Submission #974169

# Submission time Handle Problem Language Result Execution time Memory
974169 2024-05-03T03:33:46 Z blackscreen1 Hidden Sequence (info1cup18_hidden) C++17
54 / 100
4 ms 692 KB
#include <bits//stdc++.h>
using namespace std;
#define ll int
#define iloop(m, h) for (ll i = m; i != h; i += (m < h ? 1 : -1))
#define jloop(m, h) for (auto j = m; j != h; j += (m < h ? 1 : -1))
#define kloop(m, h) for (auto k = m; k != h; k += (m < h ? 1 : -1))
#define INF (ll)2e15
#define MOD2 998244353
#define pll pair<ll, ll>
#include "grader.h"


vector<int> findSequence (int N){
    vector<ll> v;
    ll lb = 0, ub = N, mid;
    while (lb < ub) {
		mid = (lb + ub + 1) >> 1;
		vector<ll> test;
		iloop(0, mid) test.push_back(0);
		if (isSubsequence(test)) lb = mid;
		else ub = mid - 1;
	}
	mid = lb;
	ll ccnt = mid;
	ll ans[mid+1];
	vector<ll> cv;
	iloop(0, mid) cv.push_back(0);
	iloop(0, mid + 1) {
		ll ctot = 0;
		while (1) {
			cv.push_back(1);
			jloop(i, 0) cv.push_back(0);
			if (cv.size() > N || !isSubsequence(cv)) {
				jloop(i, 0) cv.pop_back();
				jloop(0, ctot+1) cv.pop_back();
				break;
			}
			jloop(i, 0) cv.pop_back();
			ctot++;
			ccnt++;
		}
		ans[i] = ctot;
		cv.pop_back();
	}
	vector<ll> an;
	iloop(mid, -1) {
		jloop(0, ans[i]) an.push_back(1);
		an.push_back(0);
	}
	an.pop_back();
	return an;
}

Compilation message

hidden.cpp: In function 'std::vector<int> findSequence(int)':
hidden.cpp:33:18: warning: comparison of integer expressions of different signedness: 'std::vector<int>::size_type' {aka 'long unsigned int'} and 'int' [-Wsign-compare]
   33 |    if (cv.size() > N || !isSubsequence(cv)) {
      |        ~~~~~~~~~~^~~
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++)
      |                   ~^~~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 7
2 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 8
3 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 7
4 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 9
5 Partially correct 0 ms 344 KB Output is partially correct: Maximum length of a query = 6
# Verdict Execution time Memory Grader output
1 Partially correct 2 ms 436 KB Output is partially correct: Maximum length of a query = 124
2 Partially correct 2 ms 432 KB Output is partially correct: Maximum length of a query = 134
3 Partially correct 2 ms 436 KB Output is partially correct: Maximum length of a query = 143
4 Partially correct 3 ms 436 KB Output is partially correct: Maximum length of a query = 115
5 Partially correct 4 ms 436 KB Output is partially correct: Maximum length of a query = 141
6 Partially correct 2 ms 432 KB Output is partially correct: Maximum length of a query = 130
7 Partially correct 2 ms 436 KB Output is partially correct: Maximum length of a query = 145
8 Partially correct 2 ms 692 KB Output is partially correct: Maximum length of a query = 124
9 Partially correct 2 ms 432 KB Output is partially correct: Maximum length of a query = 150
10 Partially correct 3 ms 692 KB Output is partially correct: Maximum length of a query = 125
11 Partially correct 2 ms 432 KB Output is partially correct: Maximum length of a query = 143
12 Partially correct 2 ms 432 KB Output is partially correct: Maximum length of a query = 150
13 Partially correct 3 ms 440 KB Output is partially correct: Maximum length of a query = 150