제출 #544719

#제출 시각아이디문제언어결과실행 시간메모리
544719rainboyEditor (BOI15_edi)C11
100 / 100
230 ms51276 KiB
/* upsolve after reading analysis */ #include <stdio.h> #define N 300000 #define L 18 /* L = pow2(log2(N - 1)) */ int min(int a, int b) { return a < b ? a : b; } int main() { static int aa[N], pp[N][L + 1], aa_[N][L + 1], ll[N], ans[N]; int n, i, l; scanf("%d", &n); for (i = 0; i < n; i++) { int a; scanf("%d", &a); if (a > 0) { aa[i] = 0, ans[i] = a; pp[i][0] = i - 1, aa_[i][0] = aa[i]; for (l = 0; pp[i][l] != -1; l++) { int p = pp[i][l]; pp[i][l + 1] = pp[p][l]; aa_[i][l + 1] = min(aa_[i][l], aa_[p][l]); } ll[i] = l; } else { int p; aa[i] = -a; for (p = i - 1, l = ll[p]; l >= 0; l--) if (l <= ll[p] && aa[i] <= aa_[p][l]) p = pp[p][l]; p--; ans[i] = p == -1 ? 0 : ans[p]; pp[i][0] = p, aa_[i][0] = aa[i]; for (l = 0; (p = pp[i][l]) != -1; l++) { pp[i][l + 1] = pp[p][l]; aa_[i][l + 1] = min(aa_[i][l], aa_[p][l]); } ll[i] = l; } printf("%d\n", ans[i]); } return 0; }

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

edi.c: In function 'main':
edi.c:13:2: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   13 |  scanf("%d", &n);
      |  ^~~~~~~~~~~~~~~
edi.c:17:3: warning: ignoring return value of 'scanf' declared with attribute 'warn_unused_result' [-Wunused-result]
   17 |   scanf("%d", &a);
      |   ^~~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...