제출 #824233

#제출 시각아이디문제언어결과실행 시간메모리
824233Liudas송신탑 (IOI22_towers)C++17
0 / 100
4043 ms1444 KiB
#include "towers.h"

#include <cassert>
#include <cstdio>

#include <bits/stdc++.h>
using namespace std;
vector<int> h;
void init(int N, vector<int> H){
    h = H;
}
int max_towers(int L, int R, int D){
    int score = 0;
    for(int i = 0; i < h.size(); i ++){
        int H = h[i];
        int s = 0;
        bool good = false;
        for(int j = L; j <= R; j ++){
            if(!good && h[j] <= H){
                s ++;
                good = true;
            }
            else if(good && h[j] >= H + D){
                good = false;
            }
        }
        score = max(score, s);
    }
    return max(1, score);
}

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

towers.cpp: In function 'int max_towers(int, int, int)':
towers.cpp:14:22: warning: comparison of integer expressions of different signedness: 'int' and 'std::vector<int>::size_type' {aka 'long unsigned int'} [-Wsign-compare]
   14 |     for(int i = 0; i < h.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...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...