제출 #42329

#제출 시각아이디문제언어결과실행 시간메모리
42329milmillinDeda (COCI17_deda)C++14
0 / 140
151 ms4592 KiB
#include <cstdio> #include <vector> #include <cstring> using namespace std; int seg[600100]; void update(int idx,int l,int r,int k,int val) { if (k<l||k>=r) return; if (l+1==r) { seg[idx]=val; return; } int m = (l+r)>>1; update(idx*2,l,m,k,val); update(idx*2+1,m,r,k,val); seg[idx]=min(seg[idx*2],seg[idx*2+1]); } int get(int idx,int l,int r,int ll,int rr,int k) { if (ll>=r||rr<=l) return 2e9; if (l+1==r) return l; int m = (l+r)>>1; if (ll>=m) { return get(idx*2+1,m,r,ll,rr,k); } else if (rr<=m) { return get(idx*2,l,m,ll,rr,k); } else { if (seg[idx*2]<=k) return get(idx*2,l,m,ll,rr,k); else if (seg[idx*2+1]<=k) return get(idx*2+1,m,r,ll,rr,k); else return 2e9; } } int main () { int n,q; scanf("%d%d",&n,&q); memset(seg,63,sizeof(seg)); char x; int a,b; for (int i=0;i<q;i++) { scanf(" %c%d%d",&x,&a,&b); if (x=='M') { update(1,1,n+1,b,a); } else { printf("%d\n",get(1,1,n+1,b,n+1,a)); } } return 0; }

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

deda.cpp: In function 'int main()':
deda.cpp:38:21: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&q);
                     ^
deda.cpp:43:28: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf(" %c%d%d",&x,&a,&b);
                            ^
#Verdict Execution timeMemoryGrader output
Fetching results...