제출 #763229

#제출 시각아이디문제언어결과실행 시간메모리
763229adaawfFinancial Report (JOI21_financial)C++14
14 / 100
104 ms2888 KiB
#include <iostream> #include <vector> using namespace std; int n, d, a[500005], f[500005], res = 0; vector<int> v; void trya(int i) { if (i == n + 1) { int flag = 0; for (int j = 1; j < v.size(); j++) { if (v[j] - v[j - 1] > d) { flag = 1; break; } } if (flag == 1) return; int d = 0, ma = -1; for (int j = 0; j < v.size(); j++) { if (ma < a[v[j]]) { ma = a[v[j]]; d++; } } res = max(res, d); return; } trya(i + 1); v.push_back(i); trya(i + 1); v.pop_back(); } int main() { cin >> n >> d; for (int i = 1; i <= n; i++) { cin >> a[i]; } if (n <= 20) { trya(1); cout << res; } }

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

Main.cpp: In function 'void trya(int)':
Main.cpp:9:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
    9 |         for (int j = 1; j < v.size(); j++) {
      |                         ~~^~~~~~~~~~
Main.cpp:17:27: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   17 |         for (int j = 0; j < v.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...