Submission #1209846

#TimeUsernameProblemLanguageResultExecution timeMemory
1209846M_SH_OHidden Sequence (info1cup18_hidden)C++20
0 / 100
2 ms412 KiB
#include <bits/stdc++.h> #include "grader.h" /*#include <ext/pb_ds/assoc_container.hpp> #include <ext/pb_ds/tree_policy.hpp>*/ #define ll long long #define ll1 long long #define ull unsigned long long #define dou long double #define str string #define vll vector<ll> #define vi vector<int> #define pll pair<ll, ll> #define vpll vector<pll> #define vbool vector<bool> #define vstr vector<str> #define vvll vector<vll> #define pb push_back #define pf push_front //#define endl "\n" #define fr first #define se second // #define sortcmp(a) sort(a.begin(), a.end(), cmp) #define sort(a) sort(a.begin(), a.end()) #define reverse(a) reverse(a.begin(), a.end()) #define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0) #define INF 5000000000000000000 #define ordered_set tree<ll, null_type, less_equal<ll>, rb_tree_tag, tree_order_statistics_node_update> using namespace std; //using namespace __gnu_pbds; mt19937 rng(1488); ll randll(ll l, ll r){ return uniform_int_distribution<ll>(l, r)(rng); } vector < int > findSequence (int n) { vi a; for (int i = 0; i < n/2+1; i ++) { a.pb(0); } if (isSubsequence(a)) { a.clear(); ll k = 0; for (int i = 0; i < n; i ++) { a.pb(1); if (!isSubsequence(a)) break; } k = a.size(); vll b(k+1); ll k1 = 0; ll pos = -1; for (int i = 0; i < k+1; i ++) { a.clear(); for (int j = 0; j < i; j ++) { a.pb(1); } ll x = 0; for (int j = 0; j <(n-k)/2+1; j++) { a.pb(0); for (int i1 = 0; i1 < k-i; i1 ++) { a.pb(0); } if (!isSubsequence(a)) break; for (int i1 = 0; i1 < k-i; i1 ++) { a.pop_back(); } x ++; } b[i] = x; if (x == (n-k)/2+1) pos = i; k1 += x; } if (pos != -1) b[pos] += k-k1; a.clear(); for (int i = 0; i < k+1; i ++) { for (int j = 0; j < b[i]; j ++) { a.pb(0); } if (i < k) a.pb(1); } return a; } else { a.clear(); ll k = 0; for (int i = 0; i < n; i ++) { a.pb(0); if (!isSubsequence(a)) break; } k = a.size(); vll b(k+1); ll k1 = 0; ll pos = -1; for (int i = 0; i < k+1; i ++) { a.clear(); for (int j = 0; j < i; j ++) { a.pb(0); } ll x = 0; for (int j = 0; j <(n-k)/2+1; j++) { a.pb(1); for (int i1 = 0; i1 < k-i; i1 ++) { a.pb(1); } if (!isSubsequence(a)) break; for (int i1 = 0; i1 < k-i; i1 ++) { a.pop_back(); } x ++; } b[i] = x; if (x == (n-k)/2+1) pos = i; k1 += x; } if (pos != -1) b[pos] += k-k1; a.clear(); for (int i = 0; i < k+1; i ++) { for (int j = 0; j < b[i]; j ++) { a.pb(1); } if (i < k) a.pb(0); } return a; } } /*int main() { speed; srand(time(0)); }*/

Compilation message (stderr)

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
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...