제출 #617382

#제출 시각아이디문제언어결과실행 시간메모리
617382Abrar_Al_SamitFinancial Report (JOI21_financial)C++17
0 / 100
47 ms1364 KiB
#include<bits/stdc++.h> using namespace std; void PlayGround() { int n, D; cin>>n>>D; int a[n+1]; for(int i=1; i<=n; ++i) { cin>>a[i]; } int ans = 0; for(int mask=1; mask<(1<<n); ++mask) { vector<int>seq; for(int j=0; j<n; ++j) if(mask>>j&1) { seq.push_back(j); } bool ok = 1; for(int j=1; j<seq.size(); ++j) { ok &= seq[j]-seq[j-1]<=D; } if(!ok) continue; int cur = 0; int mx = -1; for(int j : seq) { if(a[j]>mx) { ++cur; mx = a[j]; } } ans = max(ans, cur); } cout<<ans<<'\n'; } int main() { ios_base::sync_with_stdio(false); cin.tie(NULL); PlayGround(); return 0; }

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

Main.cpp: In function 'void PlayGround()':
Main.cpp:19:19: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   19 |     for(int j=1; j<seq.size(); ++j) {
      |                  ~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...