제출 #592877

#제출 시각아이디문제언어결과실행 시간메모리
592877hyakupSimple game (IZhO17_game)C++17
0 / 100
1 ms212 KiB
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, OCaml, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <bits/stdc++.h> using namespace std; const int maxn = 1000010; int bit[maxn], height[maxn]; int n, m; void update( int i, int v){ for( int j = i; j <= n; j += j&-j) bit[j] += v; } int query( int i ){ int soma = 0; for (int j = i; j > 0; j -= j&-j) soma += bit[j]; return soma; } int main() { scanf("%d %d", &n, &m); for( int i = 1; i <= n; i++){ scanf("%d", &height[i]); update( height[i], 1 ); } for( int i = 0; i < m; i++){ int type; scanf("%d", &type); if( type == 1 ){ int pos, val; scanf("%d %d", &pos, &val); update( height[pos], -1); height[pos] = val; update( height[pos], 1); } else{ int h; scanf("%d", &h); printf("%d\n", query(h)); } } }

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

game.cpp: In function 'int main()':
game.cpp:36:10: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   36 |     scanf("%d %d", &n, &m);
      |     ~~~~~^~~~~~~~~~~~~~~~~
game.cpp:40:14: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   40 |         scanf("%d", &height[i]);
      |         ~~~~~^~~~~~~~~~~~~~~~~~
game.cpp:48:24: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   48 |         int type; scanf("%d", &type);
      |                   ~~~~~^~~~~~~~~~~~~
game.cpp:52:32: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   52 |             int pos, val; scanf("%d %d", &pos, &val);
      |                           ~~~~~^~~~~~~~~~~~~~~~~~~~~
game.cpp:63:25: warning: ignoring return value of 'int scanf(const char*, ...)' declared with attribute 'warn_unused_result' [-Wunused-result]
   63 |             int h; scanf("%d", &h);
      |                    ~~~~~^~~~~~~~~~
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...
#Verdict Execution timeMemoryGrader output
Fetching results...