제출 #67030

#제출 시각아이디문제언어결과실행 시간메모리
67030tempytemptempHidden Sequence (info1cup18_hidden)C++14
0 / 100
105 ms440 KiB
/* Let the good times roll */ #include "grader.h" #include <iostream> #include <cstdio> #include <vector> #include <set> #include <map> #include <queue> #include <stack> #include <algorithm> #include <cstring> #include <cfloat> #include <cmath> #include <cassert> #include <locale> #include <string> #include <bitset> #include <functional> #include <climits> #include <iomanip> using namespace std; #define read(x) freopen(x,"r",stdin) #define write(x) freopen(x,"w",stdout) #define cl(a,b) memset(a,b,sizeof(a)) #define all(x) x.begin(),x.end() #define rall(x) x.rbegin(),x.rend() #define ll long long #define ld long double #define vec vector #define vi vec<int> #define heap priority_queue #define res reserve #define pb push_back #define f(x,y,z) for(int x=(y); x<(z); x++) #define fd(x,y,z) for(int x=(y); x>=(z); x--) #define fit(x,y) for(auto x: y) #define srt(x) sort(all(x)) #define rsrt(x) sort(rall(x)) #define make_unique(x) sort(all((x))); (x).resize(unique(all((x))) - (x).begin()) #define pii pair<int,ll> #define ppi pair<pii,int> #define pip pair<int,pii> #define mp make_pair #define f1 first #define s2 second #define cdbg(x) cerr<<#x<<" = "<<x<<",\t"; #define cdbl cerr<<"\n----------\n"; #define pow2(x) ((x)*(x)) #define edist(x1, y1, x2, y2) (sqrt((pow2(x1-x2)+pow2(y1-y2)))) #define mdist(x1, y1, x2, y2) (abs((x1)-(x2))+abs((y1)-(y2))) #define y1 FullSensei #define mid ((ss+se)>>1) #define left (si<<1) #define right ((si<<1)+1) #define pi 3.141592653589793 #define popcount __builtin_popcount #define spc ' ' #define endl '\n' bool checkbit(int x,int y){return (x&(1<<y));} int setbit(int x,int y){return (x^(1<<y));} const int dirs[4][2]={{1,0},{0,1},{-1,0},{0,-1}}; const int mod=1e9+7; const int p1=805306457; const int p2=1610612741; const int INF=1e9; const int N=1e5+7; int oneCount(int n){ { vi v; f(i,0,n){ v.pb(1); } if(isSubsequence(v)){ return n; } } { vi v; f(i,0,n){ v.pb(0); } if(isSubsequence(v)){ return 0; } } { vi v; int i; bool fl=1; for(i=1; fl && i<=n/2+1; i++){ v.pb(1); if(!isSubsequence(v)){ fl=0; } } if(!fl){ return i-1; } } { vi v; int i; for(i=1; i<=n/2+1; i++){ v.pb(0); if(!isSubsequence(v)){ break; } } return i-1; } } //bool isSubsequence (vector < int > S); vi glob; vi ans; bool check(){ f(i,0,glob.size()){ int j=i+glob.size()/2; if(j>=glob.size()) break; vi v; f(k,i,j+1){ v.pb(glob[k]); if(!isSubsequence(v)) return false; } } return true; } bool fun(int i, int n){ if(i==n){ if(check()){ ans=glob; return true; } else{ return false; } } else{ if(fun(i+1,n)){ return true; } else{ glob[i]=1; if(fun(i+1,n)){ return true; } else{ glob[i]=0; return false; } } } } vector < int > findSequence (int n){ int cnt=oneCount(n); if(cnt==0){ vi v; f(i,0,n) v.pb(0); return v; } else if(cnt==n){ vi v; f(i,0,n) v.pb(1); return v; } f(i,0,n) glob.pb(0); fun(0,n); return ans; }

컴파일 시 표준 에러 (stderr) 메시지

hidden.cpp: In function 'bool check()':
hidden.cpp:37:37: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
 #define f(x,y,z)    for(int x=(y); x<(z); x++)
                                     ^
hidden.cpp:123:2: note: in expansion of macro 'f'
  f(i,0,glob.size()){
  ^
hidden.cpp:125:7: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
   if(j>=glob.size())
      ~^~~~~~~~~~~~~
grader.cpp: In function 'int main()':
grader.cpp:28:43: warning: format '%d' expects argument of type 'int', but argument 3 has type 'std::vector<int>::size_type {aka long unsigned int}' [-Wformat=]
     fprintf (fifo_out, "%d\n", ans.size ());
                                ~~~~~~~~~~~^
grader.cpp:29:20: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for (int i=0; i<ans.size () && i < N; i++)
                   ~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...