Submission #72048

# Submission time Handle Problem Language Result Execution time Memory
72048 2018-08-26T04:57:58 Z 마릴린 희정(#2180, gs14004, ho94949) Box Run (FXCUP3_box) C++17
0 / 100
4 ms 536 KB
#include<bits/stdc++.h>
using namespace std;
int N;
int H[1010101];
int ans[1010101];
int main()
{
  scanf("%d", &N);
  for(int i=0; i<N; ++i) scanf("%d", H+i);
  H[N] = (int)1e9+1;
  
  int from = 0, to = 0;
  multiset<int> S; S.insert(H[0]);
  for(int t=0; t<N; ++t)
  {
    while(*S.rbegin() > H[to+1])
    {
      S.insert(H[++to]);
      S.erase(S.find(H[from++]));
    }
    //printf("%d %d\n", from, to);
    ans[t] = to+1;
    if(from == 0)
      S.insert(H[++to]);
    else
      S.insert(H[--from]);
  }
  for(int i=0; i<N; ++i)
    if(ans[i] == N) printf("-1 ");
    else printf("%d ", ans[i]-i);
  puts("");
  return 0;
}

Compilation message

box.cpp: In function 'int main()':
box.cpp:8:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d", &N);
   ~~~~~^~~~~~~~~~
box.cpp:9:31: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   for(int i=0; i<N; ++i) scanf("%d", H+i);
                          ~~~~~^~~~~~~~~~~
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 4 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 3 ms 484 KB Output is correct
5 Incorrect 2 ms 536 KB Output isn't correct
6 Halted 0 ms 0 KB -
# Verdict Execution time Memory Grader output
1 Correct 3 ms 248 KB Output is correct
2 Correct 4 ms 484 KB Output is correct
3 Correct 3 ms 484 KB Output is correct
4 Correct 3 ms 484 KB Output is correct
5 Incorrect 2 ms 536 KB Output isn't correct
6 Halted 0 ms 0 KB -