제출 #167406

#제출 시각아이디문제언어결과실행 시간메모리
167406GioChkhaidzeSimple game (IZhO17_game)C++14
22 / 100
1075 ms1404 KiB
#include <bits/stdc++.h> #define Tree int h,int l,int r #define Left 2*h,l,(l+r)/2 #define Right 2*h+1,(l+r)/2+1,r using namespace std; const int N=1e6+5; int n,m,L,R,type,idx,val,dl,res; int a[N]; main () { scanf("%d%d",&n,&m); for (int i=1; i<=n; i++) scanf("%d",&a[i]); while (m--) { scanf("%d",&type); if (type==1) { scanf("%d%d",&idx,&val); a[idx]=val; } else { scanf("%d",&idx); res=0; for (int j=2; j<=n; j++) if (a[j-1]<idx && idx<a[j] || a[j]<idx && idx<a[j-1]) res++; printf("%d\n",res); } } }

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

game.cpp:10:7: warning: ISO C++ forbids declaration of 'main' with no type [-Wreturn-type]
 main () {
       ^
game.cpp: In function 'int main()':
game.cpp:26:20: warning: suggest parentheses around '&&' within '||' [-Wparentheses]
     if (a[j-1]<idx && idx<a[j] || 
         ~~~~~~~~~~~^~~~~~~~~~~
game.cpp:11:7: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
  scanf("%d%d",&n,&m);
  ~~~~~^~~~~~~~~~~~~~
game.cpp:14:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&a[i]);
   ~~~~~^~~~~~~~~~~~
game.cpp:17:8: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
   scanf("%d",&type);
   ~~~~~^~~~~~~~~~~~
game.cpp:19:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d%d",&idx,&val);
    ~~~~~^~~~~~~~~~~~~~~~~~
game.cpp:23:9: warning: ignoring return value of 'int scanf(const char*, ...)', declared with attribute warn_unused_result [-Wunused-result]
    scanf("%d",&idx);
    ~~~~~^~~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...