제출 #136100

#제출 시각아이디문제언어결과실행 시간메모리
136100forelax수열 (BOI14_sequence)C++14
34 / 100
72 ms1016 KiB
#include<bits/stdc++.h> using namespace std; vector<bool> digs(int ind){ vector<bool> rez(10); do{ rez[ind%10]=true; }while(ind/=10); return rez; } int n; vector<int> v; int main(){ cin>>n; v.resize(n); vector<int> g(10); for(int i = 0 ; i < n ; i ++){ cin>>v[i]; g[v[i]]++; } int t=0,td; for(int i = 0 ; i < g.size() ; i ++) if(g[i]){ t++; td=i; } if(t==1){ int rez=1; while(true){ bool good=true; for(int k = 0 ; k < n ; k ++){ if(!digs(rez+k)[td]){ rez+=k+1; good=false; } } if(good) break; } cout<<rez; return 0; } for(int i = 1 ; i <= 1000 ; i ++){ bool good=true; for(int k = 0 ; k < n ; k ++){ if(!digs(i+k)[v[k]]){ good=false; break; } } if(good){ cout<<i; return 0; } } }

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

sequence.cpp: In function 'int main()':
sequence.cpp:21:23: warning: comparison between signed and unsigned integer expressions [-Wsign-compare]
     for(int i = 0 ; i < g.size() ; i ++)
                     ~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...