Submission #923340

#TimeUsernameProblemLanguageResultExecution timeMemory
923340vjudge1Hidden Sequence (info1cup18_hidden)C++17
0 / 100
2 ms944 KiB
#include <bits/stdc++.h> #include "grader.h" #pragma GCC optimize("Ofast") #pragma GCC target("avx2") using namespace std; #define ll long long #define ld long double #define pb push_back #define pf push_front #define pii pair<int,int> #define all(v) v.begin(),v.end() #define F first #define S second #define mem(a,i) memset(a,i,sizeof(a)) #define sz(s) (int)s.size() // #define int ll #define y1 yy #define maksim gay #define ppb pop_back #define gcd(a,b) __gcd(a,b) #define in insert const int dx[4]={-1,0,1,0}; const int dy[4]={0,-1,0,1}; const int N=5e4+100; const int MAX=1e5+10; const int mod=1e9+7; vector<int> findSequence(int n){ int L=(n/2)+1; int c1=-1,c0=-1; for(int i=1;i<=L;i++){ vector<int> v; for(int j=1;j<=i;j++)v.pb(1); if(!isSubsequence(v)){ c1=i-1; c0=n-c1; break; } } if(c1==-1){ for(int i=1;i<=L;i++){ vector<int> v; for(int j=1;j<=i;j++)v.pb(0); if(!isSubsequence(v)){ c0=i-1; c1=n-c1; break; } } } vector<int> ans; int cnt0=0,cnt1=0; bool ok=0; if(c0<L){ ok=0; } else ok=1; if(!ok){ vector<int> v; v.pb(1); for(int i=1;i<=c0;i++)v.pb(0); if(!isSubsequence(v)){ ans.pb(0); c0--; cnt0++; } else{ ans.pb(1); c1--; cnt1++; } } else{ vector<int> v; v.pb(0); for(int i=1;i<=c1;i++)v.pb(1); if(!isSubsequence(v)){ ans.pb(1); c1--; cnt1++; } else{ ans.pb(0); c0--; cnt0++; } } for(int i=2;i<=n;i++){ vector<int> v=ans; v.pb(1); for(int j=1;j<=c0;j++)v.pb(0); if(isSubsequence(v))ans.pb(1); else ans.pb(0); } return ans; } // main(){ // // freopen("prizes.in", "r", stdin); // // freopen("prizes.out", "w", stdout); // ios_base::sync_with_stdio(0); // cin.tie(0); // cout.tie(0); // int t=1; // // cin>>t; // while(t--){ // solve(); // } // }

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