Submission #144040

#TimeUsernameProblemLanguageResultExecution timeMemory
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()); } }

Compilation message (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...