제출 #144040

#제출 시각아이디문제언어결과실행 시간메모리
144040model_codeSeparator (CEOI19_separator)C++17
100 / 100
302 ms11412 KiB
#include <cstdio>
#include <vector>
using namespace std;

int main() {
    int N; 
    scanf("%d",&N);
    vector<int> separators;
    int mx = -1, s = 0;
    while (N--) {
        int b;
        scanf("%d",&b);
        int a = (b + s) % 1000000000;
        if (a > mx) {
            separators.push_back(a);
            mx = a;
        } else {
            while (!separators.empty() && separators.back() > a) separators.pop_back();
        }
        printf("%d\n",s = separators.size());
    }
}

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

separator.cpp: In function 'int main()':
separator.cpp:7:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d",&N);
     ~~~~~^~~~~~~~~
separator.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf("%d",&b);
         ~~~~~^~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...