Submission #50964

#TimeUTC-0UsernameProblemLanguageResultExecution timeMemory
509642018-06-15 09:47:02SpaimaCarpatilorCake (CEOI14_cake)C++17
100 / 100
359 ms91352 KiB
#include<bits/stdc++.h>
using namespace std;
int splitPos, N, M, a[250009], stk[2][250009], sz[2];
int last, initInv[250009], nxt[250009], prv[250009];
void read ()
{
scanf ("%d %d", &N, &splitPos), M = N;
for (int i=1; i<=N; i++)
scanf ("%d", &a[i]), initInv[a[i]] = i;
for (int i=0; i<=N + 1; i++)
{
if (i > 0) prv[initInv[i]] = initInv[i - 1];
if (i <= N) nxt[initInv[i]] = initInv[i + 1];
}
last = initInv[N];
}
void del (int pos)
{
if (pos == 0) prv[nxt[pos]] = 0;
else
{
int x = prv[pos], y = nxt[pos];
nxt[x] = y, prv[y] = x;
}
}
 
הההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההההה
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Compilation message (stderr)

cake.cpp: In function 'void read()':
cake.cpp:10:35: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d %d", &N, &splitPos), M = N;
     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
cake.cpp:12:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf ("%d", &a[i]), initInv[a[i]] = i;
         ~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
cake.cpp: In function 'int main()':
cake.cpp:129:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
 scanf ("%d\n", &Q);
 ~~~~~~^~~~~~~~~~~~
cake.cpp:133:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%c ", &type);
     ~~~~~~^~~~~~~~~~~~~~
cake.cpp:137:15: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
         scanf ("%d %d\n", &p, &e);
         ~~~~~~^~~~~~~~~~~~~~~~~~~
cake.cpp:144:11: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
     scanf ("%d\n", &pos);
     ~~~~~~^~~~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...