제출 #136078

#제출 시각아이디문제언어결과실행 시간메모리
136078forelax수열 (BOI14_sequence)C++14
9 / 100
13 ms504 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=0; // 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 ++)
                     ~~^~~~~~~~~~
sequence.cpp:20:13: warning: variable 'td' set but not used [-Wunused-but-set-variable]
     int t=0,td;
             ^~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...