제출 #164454

#제출 시각아이디문제언어결과실행 시간메모리
164454LawlietCake (CEOI14_cake)C++14
35 / 100
2066 ms3972 KiB
#include <bits/stdc++.h> using namespace std; const int MAXN = 250010; const int INF = 1000000010; int n, p, q; int v[MAXN]; int ans[MAXN]; void rebuild() { int L = p - 1; int R = p + 1; int curTime = 0; ans[ p ] = curTime++; while( L != 0 || R != n + 1 ) { if( v[ L ] < v[ R ] ) ans[ L-- ] = curTime++; else ans[ R++ ] = curTime++; } } int main() { scanf("%d %d",&n,&p); v[ 0 ] = v[ n + 1 ] = INF; for(int i = 1 ; i <= n ; i++) scanf("%d",&v[i]); rebuild(); scanf("%d",&q); for(int i = 1 ; i <= q ; i++) { char a; int pos; scanf(" %c %d",&a,&pos); if( a == 'F' ) printf("%d\n",ans[ pos ]); if( a == 'E' ) { int newD; scanf("%d",&newD); for(int j = 1 ; j <= n ; j++) if( v[pos] < v[j] && v[j] <= n - newD + 1 ) v[j]--; v[ pos ] = n - newD + 1; rebuild(); } } }

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

cake.cpp: In function 'int main()':
cake.cpp:30:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d %d",&n,&p);
  ~~~~~^~~~~~~~~~~~~~~
cake.cpp:35:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&v[i]);
   ~~~~~^~~~~~~~~~~~
cake.cpp:39:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d",&q);
  ~~~~~^~~~~~~~~
cake.cpp:45:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c %d",&a,&pos);
   ~~~~~^~~~~~~~~~~~~~~~~~
cake.cpp:51:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&newD);
    ~~~~~^~~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...