Submission #134326

#TimeUsernameProblemLanguageResultExecution timeMemory
134326KastandaEditor (BOI15_edi)C++11
100 / 100
263 ms50216 KiB
// ItnoE #include<bits/stdc++.h> using namespace std; const int N = 300005, LG = 19; int n, R[N], P[N][LG], M[N][LG]; int main() { scanf("%d", &n); for (int i = 1; i <= n; i ++) { int a; scanf("%d", &a); if (a > 0) { P[i][0] = i; R[i] = a; continue; } a = - a; int nw = i - 1; for (int j = LG - 1; ~ j; j --) if (M[nw][j] >= a) nw = P[nw][j]; P[i][0] = nw - 1; R[i] = R[P[i][0]]; M[i][0] = a; for (int j = 1; j < LG; j ++) P[i][j] = P[P[i][j - 1]][j - 1], M[i][j] = min(M[i][j - 1], M[P[i][j - 1]][j - 1]); } for (int i = 1; i <= n; i ++) printf("%d\n", R[i]); return 0; }

Compilation message (stderr)

edi.cpp: In function 'int main()':
edi.cpp:8:10: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf("%d", &n);
     ~~~~~^~~~~~~~~~
edi.cpp:12:14: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         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...